mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
preparation for choosing a year at the command line
This commit is contained in:
@@ -21,9 +21,7 @@ func main() {
|
|||||||
ref, err := r.Head()
|
ref, err := r.Head()
|
||||||
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
|
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
|
||||||
|
|
||||||
// year := time.Now().Year()
|
year := time.Now().Year()
|
||||||
// yearStart := time.Time{}
|
|
||||||
// yearStart.AddDate(year, 0, 0)
|
|
||||||
data := gico.NewDataSet()
|
data := gico.NewDataSet()
|
||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
ts := c.Author.When
|
ts := c.Author.When
|
||||||
@@ -40,9 +38,13 @@ func main() {
|
|||||||
data[roundedTS] = wd
|
data[roundedTS] = wd
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
freq := [366]int{}
|
yearLength := 365
|
||||||
|
if year%4 == 0 {
|
||||||
|
yearLength++
|
||||||
|
}
|
||||||
|
freq := make([]int, yearLength)
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
if k.Year() != time.Now().Year() {
|
if k.Year() != year {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// this is equivalent to adding len(commits) to the freq total, but
|
// this is equivalent to adding len(commits) to the freq total, but
|
||||||
|
|||||||
Reference in New Issue
Block a user