-
Notifications
You must be signed in to change notification settings - Fork 653
get branch of commit on detached head #326
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
Conversation
Hey Don't suppose you could add a test showing this problem and verifying the fix. We are trying to get some improved coverage lately because there are some rather large changes in the works (internally) and we don't want to regress anything. |
Hi Jake, I'm going to try to look at this today. |
If you need a hand with the tests, like how to create tracking branches on the fly using libgit2 then i'm sure either myself or @nulltoken could help out. |
Hi Jake I've created a repository here https://github.com/grufffta/GitVersionTest that reproduces the issue for the test. I did have a brief look at using lib2git, but, if you have an example on how to create the tracking branches then I will happily switch it over as that was what was holding me back. |
Here are some libgit2sharp tests which should give you the components to do this: https://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp.Tests/BranchFixture.cs#L294 Then the test could look something like:
Appreciate you looking into this. Also it would be good to use I also like the idea of the remote branch fixture. Would be good to create a nice pattern for this sort of test |
get branch of commit on detached head
I've been using gitversion with tfs build and had some issues with building the master branch which I think is related to issue #179 although other branches build correctly.
When the repository is checked out the HEAD points to master. The commit is then checked out to a detached branch. On the develop/feature/release branches the sha commit will be different so GitVersion correctly gets the branch.
If you are building the master branch then 2 branches are found as the HEAD is pointing to the master with the same commit. As we are building a remote branch we should only look for the commit in the tracking branches.
Thanks
Gruff