Refresh hash after pull for branch refs (#791)

* Refresh hash after pull for branch refs

* Bump

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
ChristopherHX 2021-09-08 18:47:12 +02:00 committed by GitHub
parent a7a2659c0e
commit f0fd0af5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -376,6 +376,13 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
}
logger.Debugf("Cloned %s to %s", input.URL, input.Dir)
if hash.String() != input.Ref && refType == "branch" {
logger.Debugf("Provided ref is not a sha. Updating branch ref after pull")
if hash, err = r.ResolveRevision(rev); err != nil {
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
return err
}
}
if err = w.Checkout(&git.CheckoutOptions{
Hash: *hash,
Force: true,