fixing commit latest bug (#365)

This commit is contained in:
Zachary Rice authored and GitHub committed 2020-04-05 11:36:37 -04:00
1 parent 212232f80a
commit 4801818e3d
4 files changed
+35 -12

No files matched your search

+9 -2
View File
@@ -258,9 +258,16 @@ type commitInspector func(c *object.Commit, repo *Repo) error
// inspectCommit accepts a commit hash, repo, and commit inspecting function. A new commit
// object will be created from the hash which will be passed into either inspectCommitPatches
// or inspectFilesAtCommit depending on the options set.
func inspectCommit(hash string, repo *Repo, f commitInspector) error {
func inspectCommit(commit string, repo *Repo, f commitInspector) error {
if commit == "latest" {
ref, err := repo.Repository.Head()
if err != nil {
return err
}
commit = ref.Hash().String()
}
repo.Manager.IncrementCommits(1)
h := plumbing.NewHash(hash)
h := plumbing.NewHash(commit)
c, err := repo.CommitObject(h)
if err != nil {
return err