Maxim Cournoyer <[email protected]> writes: > Hi, > > Tomas Volf <[email protected]> writes: > >> Carlo Zancanaro <[email protected]> writes: >> >>> On Thu, May 14 2026, Tomas Volf wrote: >>>> I have encountered bug with the hook we install for adding Change-Id >>>> trailer. It for some reason inserts it as a first line of the commit >>>> message instead of at the end. > > Would you mind to share how to reproduce the issue? It isn't obvious > to me.
Right, sorry, that was in the initial bug report. Copy&pasting here: --8<---------------cut here---------------start------------->8--- $ git commit -m '--- test' --allow-empty [master f07a209fb1] Change-Id: I02675f1053c80563402f1acddd0a64a537f4da55 --- test $ git log -1 --format=%B Change-Id: I02675f1053c80563402f1acddd0a64a537f4da55 --- test --8<---------------cut here---------------end--------------->8--- Notice that Change-Id line is *before* `--- test' line. > > [...] > >>> I'm not sure why we're limiting ourselves to git versions and features >>> from 2017. >> >> Given that the commit-msg hook has this header >> >> # From Gerrit Code Review 3.11.1. >> # >> # Part of Gerrit Code Review (https://www.gerritcodereview.com/) >> # >> # Copyright (C) 2009 The Android Open Source Project >> >> I would not rule out the option that Maxim just added it without >> considering this particular detail. I took the liberty of CC-ing him, >> maybe he could answer this bit. > > It's, as the copyright suggests, a script borrowed from the Gerrit > project :-). It hasn't been modified. About the ways we call it, if it > resolves a clear issue, we do not need to constrain ourselves to an old > git version the same the gerrit project might; using the git version > which is in our current master tree would be fine, I think. Great, since adding the --no-divider seems to do the trick, that could be a fix. At the same time, since we are just setting a single trailer to a random value, it might be worth it to simplify the script a lot. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
