-
Notifications
You must be signed in to change notification settings - Fork 651
GitVersion creates branch named after SHA1 #1234
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
Comments
@xlegalles: Can you reproduce this outside of the specific repository, make the repository public or otherwise share something that can be debugged? Are you using GitVersionTask or |
We use Gitversion.exe v3.6.4.0 installed by Chocolatey. Of course, I can try anything you want but for instance, I don't see any way to debug what is doing GitVersion? Is it even possible that it could change the current git branch? |
What have you set |
The VCS root ID is |
@xlegalles do you have "Use mirrors" in your VCS root settings? If yes then I would suggest removing it and trying again. Besides, there should be a parameter |
Sorry but it does not change anything... |
Just upgraded our server to 2017.1.2 (build 46812) and still the same issue |
@xlegalles: Have you tried adding the configuration parameter |
@pavlovps already proposed this option that I have tried without any success... |
@xlegalles: Yea, he had two suggestions, though, so I didn't know which one of them you tried. 😕 |
@xlegalles: I just had a similar problem in a repository. The repository is not in a detached head state, though; the problem is that GitVersion (most probably -- what else?) has created a branch named after the commit id. Bizarre! Just look at this:
Can @JakeGinnivan provide any insight into why on earth this might be happening? Is it even possible that GitVersion is creating a branch? |
@asbjornu I thought it was a detached head because it looks like. But you may be right. The thing is that I am quite sure that Gitversion is responsible for that and it's really weird. |
@xlegalles: I'm pretty sure But I need to investigate further to figure this one out. I'm currently a bit stumped by |
@asbjornu - haha, yeah sorry, the solution was updated to vs2017 and the project uses the new Is there anything I can do to help? I think you might have to open with VS2017 community..! |
@dazinator: I figured it out, thanks. @xlegalles: I believe I have found the problem: if (repo.Branches.All(b => b.CanonicalName != localCanonicalName))
{
Log.Info(isBranch ?
string.Format("Creating local branch {0}", localCanonicalName) :
string.Format("Creating local branch {0} pointing at {1}", localCanonicalName, repoTipId));
repo.Refs.Add(localCanonicalName, repoTipId);
} In my testing, this ends up with the following line logged:
I have no idea in which context this is the correct behaviour. I need to dig deeper and understand why that code exists. |
@asbjornu thtat's great news. I'm still convinced that GitVersion should never create a branch because we all see it as a read-only tool i.e. it's main goal is to give information and never to modify the current Git state. |
Found it. The My suggestion would be to fiddle with this part of the code (especially Does @gep13 have ideas on how to tackle this? |
Any news? Thank you |
FYI, this pb is so annoying that I have decided to recreate the Git repo from scratch. Because since then , we have created other repositories which do not have any problem i.e. this one was still the only one to have a trouble. Believe it or not but it did not change anything! Even wo any Git history we have always the same error :( |
@xlegalles: I'm really sorry we haven't been of more help to you so far. This is a really obscure bug that I'm struggling with even understanding, so I'm struggling even more with how I'm going to fix it. We might just attempt removing the bad code, but as it lives in another repository with fewer tests, we will have to create a new pre-release NuGet package, upgrade it in this repository and then continue with that until the bug is fixed and all other tests are still green. And to the bug itself, I'm also stumped for ideas on how to reproduce it in an actual test. I'm open to ideas! |
Also, don't forget what I have already told: GitVersion is not supposed to mutate anything from a Git point of view. This is very disturbing and that's why I first opened a ticket in TeamCity: I could not imagine that this tool was the cause of my problem. |
I was able to reproduce locally by running GitVersion with the environment variable |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
I first thought it was a TeamCity bug but it may not: in one single repository from 15, we always get a report from GitVersion that uses a commit sha as the branch name i.e. a detached head. I simply added a "git branch" step before and after the gitversion one and I have to admit the evidence
So, yes, before GitVersion we have the right branch but as soon as GitVersion is executed, we get a detached head.
Of course, I have traced the vcs logs from TeamCity and there is nothing but a normal checkout of the current branch (i.e. develop)
Any idea?
The text was updated successfully, but these errors were encountered: