Subject: Re: new file leaked onto release branch

From: Junio C Hamano <[email-masked]>
Date: Wed, 14 Dec 2005 16:37:15 -0800

Johannes Schindelin <[email-masked]> 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.

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.