Linus Torvalds <torva...@linux-foundation.org> writes:

> This means that git request-pull will never rewrite the ref-name you gave 
> it.  If the local branch name is "xyzzy", that is the only branch name 
> that request-pull will ask the other side to fetch.
>
> If the remote has that branch under a different name, that's your problem 
> and git request-pull will not try to fix it up (but git request-pull will 
> warn about the fact that no exact matching branch is found, and you can 
> edit the end result to then have the remote name you want if it doesn't 
> match your local one).
>
> The new "find local ref" code will also complain loudly if you give an
> ambiguous refname (eg you have both a tag and a branch with that same
> name, and you don't specify "heads/name" or "tags/name").

I agree with the basic direction, especially the part "we will never
rewrite", is quite attractive.

But this part might be a bit problematic.  $3=master will almost
always have refs/heads/master and refs/remotes/origin/master listed
because the call to "show-ref" comes before "rev-parse --verify",
no?

> +head=$(git symbolic-ref -q "${3-HEAD}")
> +head=${head:-$(git show-ref "${3-HEAD}" | cut -d' ' -f2)}
> +head=${head:-$(git rev-parse --quiet --verify "$3")}
> +
> +# None of the above? Bad.
> +test -z "$head" && die "fatal: Not a valid revision: $3"
> +
> +# This also verifies that the resulting head is unique:
> +# "git show-ref" could have shown multiple matching refs..
>  headrev=$(git rev-parse --verify --quiet "$head"^0)
> -if test -z "$headrev"
> +test -z "$headrev" && die "fatal: Ambiguous revision: $3"

... and it would die here.  $3=for-linus may be the most common case
on the kernel list, and remotes/origin/for-linus may be unlikely to
appear in the real life (hmph, really?  perhaps people keep track of
what they pushed out the last time with it, I dunno).

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to