You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/08/07 03:20:11 UTC

(incubator-devlake) branch dev-1 updated: fix(gitextractor): update cli args when fetching remote repos

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

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


The following commit(s) were added to refs/heads/dev-1 by this push:
     new 92b18ce75 fix(gitextractor): update cli args when fetching remote repos
92b18ce75 is described below

commit 92b18ce7536ca4bc145bfc4b0d2ab38803eae83b
Author: d4x1 <15...@qq.com>
AuthorDate: Wed Aug 7 11:19:59 2024 +0800

    fix(gitextractor): update cli args when fetching remote repos
---
 backend/plugins/gitextractor/impl/impl.go           | 2 +-
 backend/plugins/gitextractor/parser/clone_gitcli.go | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/backend/plugins/gitextractor/impl/impl.go b/backend/plugins/gitextractor/impl/impl.go
index 778e0e32d..468e51734 100644
--- a/backend/plugins/gitextractor/impl/impl.go
+++ b/backend/plugins/gitextractor/impl/impl.go
@@ -73,7 +73,7 @@ func (p GitExtractor) PrepareTaskData(taskCtx plugin.TaskContext, options map[st
 		return nil, errors.BadInput.Wrap(err, "failed to parse git url")
 	}
 
-	// append user name to the git url
+	// append username to the git url
 	if op.User != "" {
 		parsedURL.User = url.UserPassword(op.User, op.Password)
 		op.Url = parsedURL.String()
diff --git a/backend/plugins/gitextractor/parser/clone_gitcli.go b/backend/plugins/gitextractor/parser/clone_gitcli.go
index ce987eb54..29d821ac4 100644
--- a/backend/plugins/gitextractor/parser/clone_gitcli.go
+++ b/backend/plugins/gitextractor/parser/clone_gitcli.go
@@ -96,7 +96,7 @@ func (g *GitcliCloner) CloneRepo(ctx plugin.SubTaskContext, localDir string) err
 	// deepen the commits by 1 more step to avoid https://github.com/apache/incubator-devlake/issues/7426
 	if since != nil {
 		// fixes error described on https://stackoverflow.com/questions/63878612/git-fatal-error-in-object-unshallow-sha-1
-		// It might be casued by the commit which being deepen has mulitple parent(e.g. a merge commit), not sure.
+		// It might be caused by the commit which being deepen has multiple parent(e.g. a merge commit), not sure.
 		if err := g.execGitCommandIn(ctx, localDir, "repack", "-d"); err != nil {
 			return errors.Default.Wrap(err, "failed to repack the repo")
 		}
@@ -128,7 +128,7 @@ func (g *GitcliCloner) execGitCloneCommand(ctx plugin.SubTaskContext, localDir s
 		if err := g.execGitCommand(ctx, cloneArgs...); err != nil {
 			return err
 		}
-		// 2. configure to fetch all branches from the remote server so we can collect new commits from them
+		// 2. configure to fetch all branches from the remote server, so we can collect new commits from them
 		gitConfig, err := os.OpenFile(path.Join(localDir, "config"), os.O_APPEND|os.O_WRONLY, 0644)
 		if err != nil {
 			return errors.Default.Wrap(err, "failed to open git config file")
@@ -137,7 +137,7 @@ func (g *GitcliCloner) execGitCloneCommand(ctx plugin.SubTaskContext, localDir s
 		if err != nil {
 			return errors.Default.Wrap(err, "failed to write to git config file")
 		}
-		// 3. fetch all branches with depth=1 so the next step would collect less commits
+		// 3. fetch all branches with depth=1 so the next step would collect fewer commits
 		// (I don't know why, but it reduced total number of commits from 18k to 7k on https://gitlab.com/gitlab-org/gitlab-foss.git with the same parameters)
 		fetchBranchesArgs := append([]string{"fetch", "--depth=1", "origin"}, args...)
 		if err := g.execGitCommandIn(ctx, localDir, fetchBranchesArgs...); err != nil {
@@ -169,7 +169,7 @@ func (g *GitcliCloner) execGitCommandIn(ctx plugin.SubTaskContext, workingDir st
 				env = append(env, fmt.Sprintf("HTTPS_PROXY=%s", taskData.Options.Proxy))
 			}
 			if taskData.ParsedURL.Scheme == "https" && ctx.GetConfigReader().GetBool("IN_SECURE_SKIP_VERIFY") {
-				args = append(args, "-c http.sslVerify=false")
+				args = append([]string{"-c http.sslVerify=false"}, args...)
 			}
 		} else if taskData.ParsedURL.Scheme == "ssh" {
 			var sshCmdArgs []string