Skip to content

Commit 0e24575

Browse files
committed
no need to store every commit, just the counts
1 parent b57fb8f commit 0e24575

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cmd/root.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var rootCmd = &cobra.Command{
8282
type authorAggregate struct {
8383
email string
8484
name string
85-
commits []*object.Commit
85+
commits int
8686
impact int
8787
score float64
8888
}
@@ -92,15 +92,14 @@ var rootCmd = &cobra.Command{
9292
authorEmail := commit.Author.Email
9393
if _, ok := authors[authorEmail]; !ok {
9494
authors[authorEmail] = &authorAggregate{
95-
email: authorEmail,
96-
name: commit.Author.Name,
97-
commits: make([]*object.Commit, 0),
95+
email: authorEmail,
96+
name: commit.Author.Name,
9897
}
9998
authorEmails = append(authorEmails, authorEmail)
10099
}
101100

102101
agg := authors[authorEmail]
103-
agg.commits = append(authors[authorEmail].commits, commit)
102+
agg.commits++
104103

105104
fileStats, err := commit.Stats()
106105
handleError(err)
@@ -133,7 +132,7 @@ var rootCmd = &cobra.Command{
133132
if agg.score < 1 {
134133
continue
135134
}
136-
fmt.Fprintf(w, "%d\t%s\t%s\t%d\t%d commits\t%d\n", rank+1, authorEmail, agg.name, int(math.Round(agg.score)), len(agg.commits), agg.impact)
135+
fmt.Fprintf(w, "%d\t%s\t%s\t%d\t%d commits\t%d\n", rank+1, authorEmail, agg.name, int(math.Round(agg.score)), agg.commits, agg.impact)
137136
}
138137
w.Flush()
139138
},

0 commit comments

Comments
 (0)