mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
add additional params to commit loader
This commit is contained in:
@@ -78,7 +78,20 @@ func (repo Repo) GetCommitChan() (chan types.Commit, error) {
|
|||||||
go func() {
|
go func() {
|
||||||
cIter.ForEach(func(c *object.Commit) error {
|
cIter.ForEach(func(c *object.Commit) error {
|
||||||
ts := c.Author.When
|
ts := c.Author.When
|
||||||
commit := types.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
commit := types.Commit{
|
||||||
|
Author: c.Author.Name,
|
||||||
|
Message: c.Message, TimeStamp: ts,
|
||||||
|
Hash: c.Hash.String(), Repo: repo.Path,
|
||||||
|
FilesChanged: 0, Added: 0, Deleted: 0,
|
||||||
|
}
|
||||||
|
stats, err := c.Stats()
|
||||||
|
if err != nil {
|
||||||
|
for _, stat := range stats {
|
||||||
|
commit.Added += stat.Addition
|
||||||
|
commit.Deleted += stat.Deletion
|
||||||
|
commit.FilesChanged++
|
||||||
|
}
|
||||||
|
}
|
||||||
cc <- commit
|
cc <- commit
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -87,7 +87,20 @@ func (repo Repo) GetCommitSet() (CommitSet, error) {
|
|||||||
}
|
}
|
||||||
cIter.ForEach(func(c *object.Commit) error {
|
cIter.ForEach(func(c *object.Commit) error {
|
||||||
ts := c.Author.When
|
ts := c.Author.When
|
||||||
commit := types.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
commit := types.Commit{
|
||||||
|
Author: c.Author.Name,
|
||||||
|
Message: c.Message, TimeStamp: ts,
|
||||||
|
Hash: c.Hash.String(), Repo: repo.Path,
|
||||||
|
FilesChanged: 0, Added: 0, Deleted: 0,
|
||||||
|
}
|
||||||
|
stats, err := c.Stats()
|
||||||
|
if err != nil {
|
||||||
|
for _, stat := range stats {
|
||||||
|
commit.Added += stat.Addition
|
||||||
|
commit.Deleted += stat.Deletion
|
||||||
|
commit.FilesChanged++
|
||||||
|
}
|
||||||
|
}
|
||||||
commits = append(commits, commit)
|
commits = append(commits, commit)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user