···
80
-
if !line.NewSha.IsZero() {
81
-
output, err := g.revList(
82
-
fmt.Sprintf("--max-count=%d", 100),
83
-
fmt.Sprintf("%s..%s", line.OldSha.String(), line.NewSha.String()),
86
-
return commitCount, fmt.Errorf("failed to run rev-list: %w", err)
80
+
if line.NewSha.IsZero() {
81
+
return commitCount, nil
89
-
lines := strings.Split(strings.TrimSpace(string(output)), "\n")
90
-
if len(lines) == 1 && lines[0] == "" {
91
-
return commitCount, nil
84
+
args := []string{fmt.Sprintf("--max-count=%d", 100)}
94
-
for _, item := range lines {
95
-
obj, err := g.r.CommitObject(plumbing.NewHash(item))
99
-
commitCount.ByEmail[obj.Author.Email] += 1
86
+
if line.OldSha.IsZero() {
87
+
// just git rev-list <newsha>
88
+
args = append(args, line.NewSha.String())
90
+
// git rev-list <oldsha>..<newsha>
91
+
args = append(args, fmt.Sprintf("%s..%s", line.OldSha.String(), line.NewSha.String()))
94
+
output, err := g.revList(args...)
96
+
return commitCount, fmt.Errorf("failed to run rev-list: %w", err)
99
+
lines := strings.Split(strings.TrimSpace(string(output)), "\n")
100
+
if len(lines) == 1 && lines[0] == "" {
101
+
return commitCount, nil
104
+
for _, item := range lines {
105
+
obj, err := g.r.CommitObject(plumbing.NewHash(item))
109
+
commitCount.ByEmail[obj.Author.Email] += 1