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

Re: new file leaked onto release branch

From
Junio C Hamano <junkio@cox.net>
Date
Dec 15, 2005, 00:37 UTC
Message-ID
<7v7ja7ures.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0512150034120.8992@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 5 quoted lines
> So, it could have been
>
> 	git pull . 5165
>
> which mistakes 5165 for a short SHA1?

I do not think git-pull would work on arbitrary SHA1 expressions, so you should be safe.

Interestingly...
        $ git rev-parse 5165
        error: short SHA1 5165 is ambiguous.
        5165

that short SHA1 is ambiguous. But a branch name immediately under .git/refs/heads takes precedence:

        $ git branch 5165 master
        $ git rev-parse 5165 master
        acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2
        acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2
And this makes it safer and unambiguous:
        $ git branch -d 5165
        Deleted branch 5165.
        $ git branch bug/5165 master
        $ git rev-parse bug/5165
        acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2

We might want to detect collisions between SHA1 prefix and branch names, but I am not sure if it is worth it in practice.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 4 in “RE: new file leaked onto release branch”
  1. Brown, LenDec 14, 2005
  2. Johannes SchindelinDec 14, 2005
  3. Junio C HamanoDec 15, 2005
  4. Johannes SchindelinDec 15, 2005

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.