diff --git a/commits/chancommits.go b/commits/chancommits.go index 40841dd..cc8b51c 100644 --- a/commits/chancommits.go +++ b/commits/chancommits.go @@ -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 }) diff --git a/commits/commits.go b/commits/commits.go index 8487d12..2cf3676 100644 --- a/commits/commits.go +++ b/commits/commits.go @@ -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 })