You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/10/24 01:07:22 UTC

[incubator-devlake] branch main updated: fix(gitextractor): update close function (#6306)

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new f8c671a2d fix(gitextractor): update close function (#6306)
f8c671a2d is described below

commit f8c671a2df1c93cdecf9d62c5c35227229335189
Author: Lynwee <li...@merico.dev>
AuthorDate: Tue Oct 24 09:07:17 2023 +0800

    fix(gitextractor): update close function (#6306)
---
 backend/plugins/gitextractor/impl/impl.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/backend/plugins/gitextractor/impl/impl.go b/backend/plugins/gitextractor/impl/impl.go
index b42c5d5bb..31eae69e4 100644
--- a/backend/plugins/gitextractor/impl/impl.go
+++ b/backend/plugins/gitextractor/impl/impl.go
@@ -22,7 +22,6 @@ import (
 	"github.com/apache/incubator-devlake/core/errors"
 	"github.com/apache/incubator-devlake/core/plugin"
 	helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-	"github.com/apache/incubator-devlake/plugins/gitextractor/parser"
 	"github.com/apache/incubator-devlake/plugins/gitextractor/tasks"
 )
 
@@ -73,12 +72,14 @@ func (p GitExtractor) PrepareTaskData(taskCtx plugin.TaskContext, options map[st
 }
 
 func (p GitExtractor) Close(taskCtx plugin.TaskContext) errors.Error {
-	if repo, ok := taskCtx.GetData().(*parser.GitRepo); ok {
-		if err := repo.Close(); err != nil {
-			return errors.Convert(err)
+	if taskData, ok := taskCtx.GetData().(*tasks.GitExtractorTaskData); ok {
+		if taskData.GitRepo != nil {
+			if err := taskData.GitRepo.Close(); err != nil {
+				return errors.Convert(err)
+			}
 		}
 	}
-	return nil
+	return errors.Default.New("task ctx is not GitExtractorTaskData which is unexpected")
 }
 
 func (p GitExtractor) RootPkgPath() string {