preparation for choosing a year at the command line

This commit is contained in:
2022-06-19 16:39:18 -06:00
parent 528c1c0a87
commit ca16dbb99b

View File

@@ -21,9 +21,7 @@ func main() {
ref, err := r.Head()
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
// year := time.Now().Year()
// yearStart := time.Time{}
// yearStart.AddDate(year, 0, 0)
year := time.Now().Year()
data := gico.NewDataSet()
err = cIter.ForEach(func(c *object.Commit) error {
ts := c.Author.When
@@ -40,9 +38,13 @@ func main() {
data[roundedTS] = wd
return nil
})
freq := [366]int{}
yearLength := 365
if year%4 == 0 {
yearLength++
}
freq := make([]int, yearLength)
for k, v := range data {
if k.Year() != time.Now().Year() {
if k.Year() != year {
continue
}
// this is equivalent to adding len(commits) to the freq total, but