mirror of
https://github.com/taigrr/gico.git
synced 2026-04-01 18:58:59 -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() {
|
||||
cIter.ForEach(func(c *object.Commit) error {
|
||||
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
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -87,7 +87,20 @@ func (repo Repo) GetCommitSet() (CommitSet, error) {
|
||||
}
|
||||
cIter.ForEach(func(c *object.Commit) error {
|
||||
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)
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user