Skip to content

Commit

Permalink
Support references other than commit has
Browse files Browse the repository at this point in the history
This enables support for flexible references, such as:
HEAD, branch, tag, heads/branch, refs/heads/branch, refs/tags/tag,
refs/remotes/origin/branch, refs/remotes/origin/HEAD, tilde and caret
(HEAD~1, master~^, tag~2, ref/heads/master~1, ...), selection by text
(HEAD^{/fix nasty bug}), hash (prefix and full).
  • Loading branch information
rentziass committed Oct 19, 2021
1 parent 38d174f commit 6240390
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions patrol/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,12 @@ func (r *Repo) detectInternalChangesFrom(revision string) error {
return err
}

ref := plumbing.NewHash(revision)
then, err := repo.CommitObject(ref)
ref, err := repo.ResolveRevision(plumbing.Revision(revision))
if err != nil {
return err
}

then, err := repo.CommitObject(*ref)
if err != nil {
return err
}
Expand Down Expand Up @@ -204,8 +208,12 @@ func (r *Repo) detectGoModulesChanges(revision string) error {
return err
}

ref := plumbing.NewHash(revision)
then, err := repo.CommitObject(ref)
ref, err := repo.ResolveRevision(plumbing.Revision(revision))
if err != nil {
return err
}

then, err := repo.CommitObject(*ref)
if err != nil {
return err
}
Expand Down

0 comments on commit 6240390

Please sign in to comment.