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

git: You are not currently on a branch #84

Open
xh3b4sd opened this issue Nov 8, 2016 · 3 comments
Open

git: You are not currently on a branch #84

xh3b4sd opened this issue Nov 8, 2016 · 3 comments

Comments

@xh3b4sd
Copy link

xh3b4sd commented Nov 8, 2016

I found gpm and wanted to give it a try. It looks like it does not support pinning dependencies based on commits. I have this in my Godeps file.

github.com/alicebob/miniredis               bb985e34f0942b1d770bf96e87f830cf38804abe

This is what I get.

# cd /path/to/workspace/src/github.com/alicebob/miniredis; git pull --ff-only
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

package github.com/alicebob/miniredis: exit status 1

Is this intended? Can we make it work?

@pote
Copy link
Owner

pote commented Nov 8, 2016

That's weird! Definitely not intended.

Interesting: I just tested it on my local environment with gpm 1.4.0 and the same Godeps file as you, on first run I had no warnings, and on second run I have the same warning you are getting.

sample

Behind the scenes gpm uses go get, coupled with the -u flag to fetch any updates that have been pushed to the repository between last time you updated it and now. When the dependency is in a detached head state we get warnings from git.

This isn't necessarily a problem: as long as the following line is present it means the commit you requested is in the local history and has been set.

>> Setting github.com/alicebob/miniredis to version bb985e34f0942b1d770bf96e87f830cf38804abe

Although... I do agree its ugly. 😅

Would it be worthwhile to add code to solve this warning? I'll think of a way around it, off the top of my head I can think about storing the default branch and checking it out before the update, or simply suggest deleting the directory and fetching it again. I could also simply delete it automatically, but I'm not big on deleting things without explicit user conscent.

What do you think?

@xh3b4sd
Copy link
Author

xh3b4sd commented Nov 8, 2016

Thanks for coming back. I think it is a good idea to checkout the default branch, do the go get magic, and checkout the desired revision. I am not a massive fan of storing information about the default branch. Git for instance does that somehow. See http://stackoverflow.com/questions/18726037/what-determines-default-branch-after-git-clone. Not sure about svn, mercurial etc..

@myusuf3
Copy link

myusuf3 commented Nov 8, 2016

Let's not go the delete route. What @xh3b4sd suggested in his last comment looks good.

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