diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-10-15 18:49:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 12:49:26 +0200 |
commit | d98c5db58fdeded983bf5c0fe781fd7b77a1235f (patch) | |
tree | 2816c975613f2f44b80bdd9cba01ebb1ee6bc9e4 /modules/git/repo_stats.go | |
parent | 7917123209d7974662baccf21346f1989247550a (diff) | |
download | gitea-d98c5db58fdeded983bf5c0fe781fd7b77a1235f.tar.gz gitea-d98c5db58fdeded983bf5c0fe781fd7b77a1235f.zip |
alternative to PR "improve code quality" (#21464)
This PR doesn't require new git version, and can be backported easily.
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/git/repo_stats.go')
-rw-r--r-- | modules/git/repo_stats.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/git/repo_stats.go b/modules/git/repo_stats.go index cb44c58cec..7eccf9a190 100644 --- a/modules/git/repo_stats.go +++ b/modules/git/repo_stats.go @@ -61,15 +61,15 @@ func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) _ = stdoutWriter.Close() }() - args := []string{"log", "--numstat", "--no-merges", "--pretty=format:---%n%h%n%aN%n%aE%n", "--date=iso", fmt.Sprintf("--since='%s'", since)} + gitCmd := NewCommand(repo.Ctx, "log", "--numstat", "--no-merges", "--pretty=format:---%n%h%n%aN%n%aE%n", "--date=iso", fmt.Sprintf("--since='%s'", since)) if len(branch) == 0 { - args = append(args, "--branches=*") + gitCmd.AddArguments("--branches=*") } else { - args = append(args, "--first-parent", branch) + gitCmd.AddArguments("--first-parent").AddDynamicArguments(branch) } stderr := new(strings.Builder) - err = NewCommand(repo.Ctx, args...).Run(&RunOpts{ + err = gitCmd.Run(&RunOpts{ Env: []string{}, Dir: repo.Path, Stdout: stdoutWriter, |