Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 2017 22:00:48 -0700
From:      Yuri <yuri@rawbw.com>
To:        Mathieu Arnold <mat@freebsd.org>, "O. Hartmann" <ohartmann@walstatt.org>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: [ports]: GH_TAGNAME: how to figure out this tagname on downloadable archives?
Message-ID:  <a7236dbd-84f3-e838-55fe-1b9f58a42543@rawbw.com>
In-Reply-To: <c677889a-41c3-5105-4f87-f0159d0f65d1@FreeBSD.org>
References:  <20171015211940.44065925@thor.intern.walstatt.dynvpn.de> <19aa7f0a-3b52-5d34-cf80-136ef3fe489b@rawbw.com> <20171015214725.68e32dd9@thor.intern.walstatt.dynvpn.de> <c677889a-41c3-5105-4f87-f0159d0f65d1@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/16/17 07:46, Mathieu Arnold wrote:
> The first 7 digits may, or may not be sufficient. 7 is a magic number,
> and should not be used. You should, instead, ask git directly what the
> abbreviation should be with, for instance, `git log --abbrev-commit`.
> It may give you a number that seven digits long, but it may very well
> give you a longer one. I repeat, do not simply truncate a hash to its
> first 7 digits, it may not be enough.

`git log --abbrev-commit` solution has two shortcomings. It only protects against preexisting hash collisions and not from future collisions. So, the port's fetch can still spontaneously fail in the future as a result of a future commit that introduces a collision. Secondly, it requires the manual clone of the repository which is inconvenient. IMO, it's more practical to just use 7 digits, and switch to the full hash in an unlikely event when 7 digits fail. So far, this method virtually always worked.

Yuri




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a7236dbd-84f3-e838-55fe-1b9f58a42543>