mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
reorder funcs by usage order
This commit is contained in:
@@ -58,6 +58,29 @@ func GlobalFrequencyChan(year int, authors []string) (types.YearFreq, error) {
|
||||
return freq, nil
|
||||
}
|
||||
|
||||
func (repo Repo) GetCommitChan() (chan types.Commit, error) {
|
||||
cc := make(chan types.Commit, 30)
|
||||
r := git.Repository(repo)
|
||||
ref, err := r.Head()
|
||||
if err != nil {
|
||||
return cc, err
|
||||
}
|
||||
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
|
||||
if err != nil {
|
||||
return cc, err
|
||||
}
|
||||
go func() {
|
||||
cIter.ForEach(func(c *object.Commit) error {
|
||||
ts := c.Author.When
|
||||
commit := types.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
||||
cc <- commit
|
||||
return nil
|
||||
})
|
||||
close(cc)
|
||||
}()
|
||||
return cc, nil
|
||||
}
|
||||
|
||||
func YearFreqFromChan(cc chan types.Commit, year int) types.YearFreq {
|
||||
yearLength := 365
|
||||
if year%4 == 0 {
|
||||
@@ -110,26 +133,3 @@ func FilterCChanByAuthor(in chan types.Commit, authors []string) (chan types.Com
|
||||
}()
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (repo Repo) GetCommitChan() (chan types.Commit, error) {
|
||||
cc := make(chan types.Commit, 30)
|
||||
r := git.Repository(repo)
|
||||
ref, err := r.Head()
|
||||
if err != nil {
|
||||
return cc, err
|
||||
}
|
||||
cIter, err := r.Log(&git.LogOptions{From: ref.Hash()})
|
||||
if err != nil {
|
||||
return cc, err
|
||||
}
|
||||
go func() {
|
||||
cIter.ForEach(func(c *object.Commit) error {
|
||||
ts := c.Author.When
|
||||
commit := types.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
||||
cc <- commit
|
||||
return nil
|
||||
})
|
||||
close(cc)
|
||||
}()
|
||||
return cc, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user