On Mon, Jul 19, 2021 at 11:47:01AM +0100, Iain Sandoe wrote: > > > > On 19 Jul 2021, at 11:39, Richard Biener via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > > > > On Fri, Jul 16, 2021 at 12:37 PM Serge Belyshev > > <belys...@depni.sinp.msu.ru> wrote: > >> > >> Based on discussion I've chosen open-coded version without commit hash. > > > > As said I'd prefer one with (shortened) hash, > > Likewise, I’ve been using a local change to produce “r12-2447-gcca1e30db142” > since soon after > change; I suspect that 12 digits is ‘enough’. It makes it easier for the > folks who want to find by > SHA1 as well as folks who want to find by revision number.
If the patch is changed from revision=$r; to revision=${r}-g${revision}; then the exact hash length isn't hardcoded to 12 digits, but whatever git chooses to make it unique (with the current state of repository). Of course, changes later on in the repository can introduce collisions and more hash letters might be needed, but that is a general git problem. And at least when we have the rXX-YYYY-gZZZZZZZZZ revisions, it is still unique on the release branches, just one might need to use $(git gcc-descr `echo $rev | sed 's/-g[0-9a-f]*$//'`) instead of just $rev in case such collision happens if git tells rXX-YYYY-gZZZZZZZZ is ambiguous. Jakub