Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitVersion fails on AppVeyor when building a pull request (or any detached HEAD) #1666

Closed
tskardal opened this issue Apr 25, 2019 · 4 comments

Comments

@tskardal
Copy link

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 */
@tskardal
Copy link
Author

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.

@tskardal tskardal changed the title GitVersion fails on AppVeyor when building a pull request GitVersion fails on AppVeyor when building a pull request (or any detached HEAD) May 22, 2019
@mycroes
Copy link

mycroes commented Jun 4, 2019

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.

@roryprimrose
Copy link

I'm hitting this in Jenkins, but no newer commits have been pushed to remote.

@tskardal
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants