Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow specifying any remote ref in git checkout URLs #32502
When specifying git URLs
edit: this pr used to be specifically for checking out PRs
Signed-off-by: Tonis Tiigi email@example.com
@aaronlehmann It's a convention, I'm not sure how many other sites use it. https://bitbucket.org/site/master/issues/5814/reify-pull-requests-by-making-them-a-ref is issue from bitbucket for adding the same thing.
@thaJeztah We already support lots of magic for this. For example, we even support
@ijc25 That wouldn't work. You have to fetch the remote reference as they are not pulled in clone and can't be checked out. It still defaults to tag and branch so wouldn't break anyone. That ambiguous behavior is kind of builtin to git where refname can mean multiple things and there is a priority order of what is checked out first(tag -> branch -> remote-branch etc).
@tonistiigi I meant that the fall back behaviour should be to try and pull the named things precisely, rather than a massaged version of it.
I don't think the particular ambiguity I spoke about is to do with refname fallbacks like you suggest. It is down to the default refspec used on clone, which is
In any case someone who wanted PR
@tonistiigi Sorry, for the delay, there were public holiday's here.
In fact in this "mode" you could just
Sadly this (and all the variants of it I tried) doesn't seem to do what I hoped:
it needs a manual
Apr 25, 2017
@ijc25 Updated. I also noticed that when no ref is specified we did a clone with
Maybe you have a better idea for https://github.com/moby/moby/pull/32502/files#diff-eac74eb810b282bbc18d5db1cca37b87R92 , I'm currently doing a checkout by name first so it wouldn't break anyone depending on reading current branch name from
Looks good to me, at least by code inspection. Using
I was a bit surprised this worked, but I checked and TIL that
This invalidates one suggestion I was about to make which was to skip the
Some of this is perhaps a bit subtle, maybe a comment at the top explaining the expected flow of commands and why they are there would be helpful?
I think you are correct, it appeared to work for me because I tested it with a sha which was already present locally. If I try with one which is not present locally then it fails against GH at least:
(that was trying to pull one of the parents of
Seems that using
but dropping the
A bit odd. Anyway, you are correct that fetch by sha indeed doesn't work in the common case.
Does this need an update to the documentation? https://github.com/moby/moby/blob/master/docs/reference/commandline/build.md#git-repositories
May 15, 2017
May 15, 2017
6 checks passed
After this PR, docker doesn't pull git repository recursively any more, is that the intended behavior?
I think this is because