New git clone/fetch method does not create origin/HEAD
Somewhere between versions 11.8.0 (4745a6f3) and 11.9.0-rc2 (227934c0), code check outs lost their connection with
origin/HEAD. I have been using that refspec for a bit over a year in two scheduled jobs to check for upstream changes. This has been working without issues until 2019-03-13 and started failing on 2019-03-15.
Steps to reproduce
.gitlab-ci.yml will reproduce the issue.
image: alpine:latest head-test: script: - apk add --no-cache git - git branch -a # illustrates absence of origin/HEAD (and detached HEAD) - git diff origin/$CI_COMMIT_REF_NAME # works fine - git diff origin/HEAD # used to work fine
git diff command fails as follows
$ git diff origin/HEAD fatal: ambiguous argument 'origin/HEAD': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'
I had expected both
git diff commands to succeed and produce the same result.
Relevant logs and/or screenshots
The jobs are for different projects but do essentially the same thing. The salient part is that they use the same
git diffcommand to check for changes and that command is what starts failing the job.
Using shared Runners on GitLab.com.
Used GitLab Runner version
As illustrated in the
.gitlab-ci.yml above, one can work around this issue by using
origin/$CI_COMMIT_REF_NAME instead of