[ports]: GH_TAGNAME: how to figure out this tagname on downloadable archives?
yuri at rawbw.com
Tue Oct 17 05:00:57 UTC 2017
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.
More information about the freebsd-ports