You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/05/11 09:08:24 UTC
(incubator-devlake) branch kw-7426-gitext-incorrect-loc created (now 130cf759e)
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a change to branch kw-7426-gitext-incorrect-loc
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
at 130cf759e fix: incorrect LOC of the first commit in a given time range
This branch includes the following new commits:
new 130cf759e fix: incorrect LOC of the first commit in a given time range
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-devlake) 01/01: fix: incorrect LOC of the first commit in a given time range
Posted by kl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch kw-7426-gitext-incorrect-loc
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 130cf759e5e614334f46a73adf4610261ade9594
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Sat May 11 17:08:06 2024 +0800
fix: incorrect LOC of the first commit in a given time range
---
backend/plugins/gitextractor/gitextractor.go | 2 +-
backend/plugins/gitextractor/parser/clone_gitcli.go | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/backend/plugins/gitextractor/gitextractor.go b/backend/plugins/gitextractor/gitextractor.go
index 5032381aa..0f9db3026 100644
--- a/backend/plugins/gitextractor/gitextractor.go
+++ b/backend/plugins/gitextractor/gitextractor.go
@@ -36,7 +36,7 @@ func main() {
// pkPass := cmd.Flags().StringP("privateKeyPassPhrase", "P", "", "passphrase for private key")
proxy := cmd.Flags().StringP("proxy", "x", "", "proxy")
useGoGit := cmd.Flags().BoolP("useGoGit", "g", false, "use go-git instead of libgit2")
- skipCommitStat := cmd.Flags().BoolP("skipCommitStat", "S", true, "")
+ skipCommitStat := cmd.Flags().BoolP("skipCommitStat", "S", false, "")
skipCommitFiles := cmd.Flags().BoolP("skipCommitFiles", "F", true, "")
timeAfter := cmd.Flags().StringP("timeAfter", "a", "", "collect data that are created after specified time, ie 2006-01-02T15:04:05Z")
_ = cmd.MarkFlagRequired("url")
diff --git a/backend/plugins/gitextractor/parser/clone_gitcli.go b/backend/plugins/gitextractor/parser/clone_gitcli.go
index 20f8f200d..745af661a 100644
--- a/backend/plugins/gitextractor/parser/clone_gitcli.go
+++ b/backend/plugins/gitextractor/parser/clone_gitcli.go
@@ -90,6 +90,13 @@ func (g *GitcliCloner) CloneRepo(ctx plugin.SubTaskContext, localDir string) err
}
return err
}
+ // deepen the commits by 1 more step to avoid https://github.com/apache/incubator-devlake/issues/7426
+ if since != nil {
+ cmd := exec.CommandContext(ctx.GetContext(), "git", "-C", localDir, "fetch", "--deepen=1")
+ if err := cmd.Run(); err != nil {
+ return errors.Default.Wrap(err, "failed to deepen the cloned repo")
+ }
+ }
// save state
if g.stateManager != nil {