From: Junio C Hamano <gitster@pobox•com>
To: Linus Torvalds <torvalds@linux-foundation•org>
Cc: Tejun Heo <tj@kernel•org>, Git Mailing List <git@vger•kernel.org>
Subject: Re: [RFC PATCH] Make 'git request-pull' more strict about matching local/remote branches
Date: Wed, 22 Jan 2014 13:46:54 -0800 [thread overview]
Message-ID: <xmqq1tzzy9ip.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1401221243090.18459@i7.linux-foundation.org> (Linus Torvalds's message of "Wed, 22 Jan 2014 13:08:54 -0800 (PST)")
Linus Torvalds <torvalds@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).
next prev parent reply other threads:[~2014-01-22 21:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 21:08 [RFC PATCH] Make 'git request-pull' more strict about matching local/remote branches Linus Torvalds
2014-01-22 21:46 ` Junio C Hamano [this message]
2014-01-22 22:03 ` Linus Torvalds
2014-01-22 22:07 ` Linus Torvalds
2014-01-22 22:14 ` Junio C Hamano
2014-01-22 22:20 ` Linus Torvalds
2014-01-22 22:27 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1tzzy9ip.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=tj@kernel$(echo .)org \
--cc=torvalds@linux-foundation$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox