git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] Make 'git request-pull' more strict about matching local/remote branches

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jan 22, 2014, 22:03 UTC
Message-ID
<CA+55aFxSiKhM=4GtFaruWNZFNaUgCpVHsJOWJ9Qcd19nz6YYTw@mail.gmail.com>
In-Reply-To
<xmqq1tzzy9ip.fsf@gitster.dls.corp.google.com>
On Wed, Jan 22, 2014 at 1:46 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
>>
>> 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").
>
> 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?
Hmm. Yes.

It's done that way very much on purpose, to avoid the branch/tag ambiguity (which we have had problems with), but you're right, it also ends up being ambiguous wrt remote branches, which wasn't the intention, and you're right, that is not acceptable.

Damn. I very much want to get the full ref-name (ie "master" should become "refs/heads/master"), and I do want to avoid the branch/tag ambiguity, but you're right, "show-ref" plus the subsequent "rev-parse --verify" comes close but not quite close enough.

Any ideas? The hacky way is to do "| head -1" to take the first show-ref output, and then check if you get a different result if you re-do it using "show-ref --tags". But that sounds really excessively hacky. Is there a good way to do it?

                 Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 3 of 7 in “Make 'git request-pull' more strict about matching local/remote branches”
  1. Make 'git request-pull' more strict about matching local/remote branchesLinus Torvalds, Jan 22, 2014
  2. Junio C HamanoJan 22, 2014
  3. Linus TorvaldsJan 22, 2014
  4. Linus TorvaldsJan 22, 2014
  5. Junio C HamanoJan 22, 2014
  6. Linus TorvaldsJan 22, 2014
  7. Junio C HamanoJan 22, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.