This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new 7a805c1cb fix(gitextractor): update cli args when fetching remote
repos (#7853) (#7863)
7a805c1cb is described below
commit 7a805c1cb457cabfaa562bb1998cc3edf4273110
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Aug 7 22:26:52 2024 +0800
fix(gitextractor): update cli args when fetching remote repos (#7853)
(#7863)
* style(helpers): fix some typos
* fix(gitextractor): update cli args when fetching remote repos
Co-authored-by: Lynwee <[email protected]>
---
backend/helpers/pluginhelper/api/collector_state_manager.go | 2 +-
backend/helpers/pluginhelper/api/subtask_state_manager.go | 2 +-
backend/plugins/gitextractor/impl/impl.go | 2 +-
backend/plugins/gitextractor/parser/clone_gitcli.go | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/backend/helpers/pluginhelper/api/collector_state_manager.go
b/backend/helpers/pluginhelper/api/collector_state_manager.go
index 8aeeffebc..b977b12bb 100644
--- a/backend/helpers/pluginhelper/api/collector_state_manager.go
+++ b/backend/helpers/pluginhelper/api/collector_state_manager.go
@@ -84,7 +84,7 @@ func NewCollectorStateManager(basicRes context.BasicRes,
syncPolicy *models.Sync
return
}
- // if timeAfter is not set or NOT before the previous vaule, we are in
the incremental mode
+ // if timeAfter is not set or NOT before the previous value, we are in
the incremental mode
if syncPolicy.TimeAfter == nil || state.TimeAfter == nil ||
!syncPolicy.TimeAfter.Before(*state.TimeAfter) {
stateManager.isIncremental = true
stateManager.since = state.LatestSuccessStart
diff --git a/backend/helpers/pluginhelper/api/subtask_state_manager.go
b/backend/helpers/pluginhelper/api/subtask_state_manager.go
index 22f71453d..86453c124 100644
--- a/backend/helpers/pluginhelper/api/subtask_state_manager.go
+++ b/backend/helpers/pluginhelper/api/subtask_state_manager.go
@@ -118,7 +118,7 @@ func NewSubtaskStateManager(args *SubtaskCommonArgs)
(stateManager *SubtaskState
if syncPolicy.FullSync || state.PrevStartedAt == nil {
return
}
- // if timeAfter is not set or NOT before the previous vaule, we are in
the incremental mode
+ // if timeAfter is not set or NOT before the previous value, we are in
the incremental mode
if (syncPolicy.TimeAfter == nil || state.TimeAfter == nil ||
!syncPolicy.TimeAfter.Before(*state.TimeAfter)) &&
// and the previous config is the same as the current config
(state.PrevConfig == "" || state.PrevConfig ==
stateManager.config) {
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