Skip to content
Snippets Groups Projects

Initial implementation of an elasticsearch indexer in Go

Merged Nick Thomas requested to merge 1-initial-implementation into master
All threads resolved!
2 files
+ 61
15
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 9
8
@@ -38,7 +38,7 @@ func NewGoGitRepository(projectPath string, fromSHA string, toSHA string) (*goGi
} else {
out.FromHash = plumbing.NewHash(fromSHA)
commit, err := out.Repository.CommitObject(out.FromHash)
commit, err := repo.CommitObject(out.FromHash)
if err != nil {
return nil, fmt.Errorf("Bad from SHA (%s): %s", out.FromHash, err)
}
@@ -149,10 +149,15 @@ func (r *goGitRepository) EachFileChange(ins, mod, del FileFunc) error {
return nil
}
// EachCommit runs `f` for each commit within `fromSHA`...`toSHA` (i.e., the
// inclusive set).
// EachCommit runs `f` for each commit within `fromSHA`..`toSHA`
// go-git doesn't directly support ranges of revisions, so we emulate this by
// walking the commit history between from and to
func (r *goGitRepository) EachCommit(f CommitFunc) error {
err := object.WalkCommitHistory(r.ToCommit, func(c *object.Commit) error {
err := object.WalkCommitHistoryPost(r.ToCommit, func(c *object.Commit) error {
if r.FromCommit != nil && c.ID() == r.FromCommit.ID() {
return endError
}
}
commit := &Commit{
Message: c.Message,
@@ -164,10 +169,6 @@ func (r *goGitRepository) EachCommit(f CommitFunc) error {
return err
}
if r.FromCommit != nil && c.ID() == r.FromCommit.ID() {
return endError
}
return nil
})
Loading