Skip to content

Commit 0fcc627

Browse files
committed
add --full flag
1 parent 261f56b commit 0fcc627

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cmd/root.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ func handleError(err error) {
2323
}
2424

2525
var (
26-
remote bool
2726
decayDays int
27+
full bool
28+
remote bool
2829
)
2930

3031
func init() {
31-
rootCmd.Flags().BoolVarP(&remote, "remote", "r", false, "whether or not this is a remote repository")
3232
rootCmd.Flags().IntVarP(&decayDays, "decay-rate", "d", 30, "determines how long it takes for the impact of a commit to halve, based on how recently the commit was made")
33+
rootCmd.Flags().BoolVarP(&remote, "remote", "r", false, "whether or not this is a remote repository")
34+
rootCmd.Flags().BoolVarP(&full, "full", "f", false, "include all commits when calculating scores")
3335
}
3436

3537
var rootCmd = &cobra.Command{
@@ -73,7 +75,10 @@ var rootCmd = &cobra.Command{
7375
decayHours := 24 * decayDays
7476

7577
// this ignores any commits older than 100 half-lives,
76-
since := time.Now().Add(-(time.Duration(decayHours) * time.Hour * 10))
78+
var since time.Time
79+
if !full {
80+
since = time.Now().Add(-(time.Duration(decayHours) * time.Hour * 10))
81+
}
7782
commitIter, err := repo.Log(&git.LogOptions{
7883
Order: git.LogOrderCommitterTime,
7984
FileName: fileName,

0 commit comments

Comments
 (0)