add additional params to commit loader

This commit is contained in:
2023-02-07 14:44:02 -08:00
parent c2d04ed3b0
commit 9271b27511
2 changed files with 28 additions and 2 deletions

View File

@@ -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
})