1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

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 26a3ec75a6
commit cbcc52c438

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,