GitVersion fails on AppVeyor when building a pull request (or any detached HEAD)
When creating a pull request in GitHub, a new build is started on AppVeyor.
It is checked out as follows:
git clone -q https://github.com/org/project.git C:\projects\project
git fetch -q origin +refs/pull/6/merge:
git checkout -qf FETCH_HEAD
This causes GitVersion to report an error due to "GitTools.Git.BugException: GitTools.Core has a bug, your HEAD has moved after repo normalisation."
Does this mean that I have to disable building of pull requests, could I have done something else that causes this problem, or is it actually a bug?
Here's the output of git log --graph --format="%h %cr %d" --decorate --date=relative --all --remotes="*" -n 100:
* 26320fea 49 minutes ago (HEAD)
|\
| * b8c69a52 49 minutes ago (origin/develop)
| * 1cb707f6 60 minutes ago
| * f7762c45 74 minutes ago
| |\
| | * c0349c87 20 hours ago
| | * 50142367 21 hours ago
| | * 8f305d2b 22 hours ago
| | * dcfcdcd3 2 days ago
| * | 624b4913 15 hours ago
| * | a2b81c37 15 hours ago
|/ /
* | 9e634b80 13 days ago (origin/master, master)
* | b7595ec4 13 days ago
* | aee5a4e2 13 days ago
* | 1c7cd57a 13 days ago
* | 110575be 13 days ago
* | 142d0606 13 days ago
|/
* bc05defc 2 weeks ago (tag: v1.10.0)
/* snip */
This also seems to be a problem when builds are being queued on AppVeyor. If newer commits have been pushed to the branch, then gitversion will fail.
I have a similar issue, which I believe shares the cause. I have commits meant for a branch (similar to a PR in that sense) which have different refs (refs/changes/[2-digits]/[5-digits]/[1+digit]). So if those commits are meant for develop, the build server (Jenkins) will checkout a branch develop at the specified ref. During repo normalization it will however update the local develop to remote develop, which is of course a different commit and gives the error above. In my case the pointer for this issue was the message Updating local branch develop to match ref refs/remotes/origin/develop. Unfortunately, I haven't found a fix either.
Actually, when GitVersion doesn't detect a buildserver and doesn't attempt to do normalization it will output the correct version as well.
I'm hitting this in Jenkins, but no newer commits have been pushed to remote.
I'm crossing my fingers that this is fixed in the next version as GitTools.Core is being removed (see #1581).
This issue might be interesting too: GitTools/GitTools.Core#49