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

Re: new file leaked onto release branch

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 15, 2005, 01:29 UTC
Message-ID
<Pine.LNX.4.63.0512150208190.9568@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7v7ja7ures.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 14 Dec 2005, Junio C Hamano wrote:
Show 10 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 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.

D'oh. I wanted to write it short, but I guess that made it only more confusing. In reality, Len used "git merge", and that works quite well with short SHA1s.

However, I just verified (as you did also), that they do not take precedence over branch names (the relevant piece of code is in get_sha1_1: get_short_sha1() is called only if get_sha1_basic() fails).

Show 7 quoted lines
> Interestingly...
> 
>         $ git rev-parse 5165
>         error: short SHA1 5165 is ambiguous.
>         5165
> 
> that short SHA1 is ambiguous.

I don't want to be a PITA, but it could be ambiguous only since short time ago.

Show 6 quoted lines
> But a branch name immediately under .git/refs/heads takes precedence:
>
>         $ git branch 5165 master
>         $ git rev-parse 5165 master
>         acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2
>         acd9b7b4e08a3f0f48afa922d8e371414cf2d3b2

There is an interesting side effect: If 5165 as a short SHA1 would be unique, and there is a tag *and* a branch named 5165, git-rev-parse would expand the short SHA1...

However, it still does not solve the original riddle.

Ciao, Dscho

Previous: Junio C Hamano
Message 4 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.