hashar added a comment.

  The hook in upstream is at 
https://gerrit.googlesource.com/gerrit/+/refs/heads/master/resources/com/google/gerrit/server/tools/root/hooks/commit-msg
 (git log 
<https://gerrit.googlesource.com/gerrit/+log/refs/heads/master/resources/com/google/gerrit/server/tools/root/hooks/commit-msg>).
  
  It seems to add the `Change-Id` header using `git-interpret-trailers` which 
would be the command being confused by the Depend a bot commit message. The 
reason is that it insert the header before the line having `---` which must be 
handled specifically by `git-interpret-trailers`?
  
  Repro:
  
  name=git version 2.34.1
    $ 'echo '---' |git interpret-trailers --trailer "Change-Id: FOO"
    
    Change-Id: FOO
    ---
    $
  
  From the `git-interpret-trailers(1)` man page:
  
  > The group must either be at the end of the message or be the last 
non-whitespace lines before a line that starts with `---` (followed by a space 
or the end of the line). **Such three minus signs start the patch part of the 
message.** See also `--no-divider` below.
  
  `--- ` is used when show the whole commit which will have the commit message 
and the patch itself.  The patch would show the diff eg:
  
    ...
        Some oneline message 
    
        Signed-off-by: whoever
    
    diff --git a/Documentation/RelNotes/2.36.0.txt 
b/Documentation/RelNotes/2.36.0.txt
    new file mode 100644
    index 0000000000..c59e0c80e9
    --- /dev/null
    +++ b/Documentation/RelNotes/2.36.0.txt
  
  So if you want add a trailer using a full patch, that will work. But in the 
case of dependend a bot that causes it to stop processing.
  
  And there is:
  
  > `--no-divider`
  > Do not treat `---` as the end of the commit message.
  > Use this when you know your input contains just the commit message itself 
(and not an email or the output of `git format-patch`).
  
  Which sounds like the use case for the Gerrit commit-msg hook. There is 
unfortunately no git config setting to turn it off :-\
  
  The git commit adding `--no-divider` is 
1688c9a4894df517241026c7a3848bdc84607986 released in Git 2.19.2
  
  I guess we can ask GitHub to amend their depend a bot to use four minus 
signs, they seem to use that to in markdown context to generate a `<hr/>` and 
they missed that is specially handled by git interpret-trailer. That is my 
favorite way to fix it.   The alternatively is to craft a patch for Gerrit 
upstream to amend the commit-msg hook and use `--no-divider`.

TASK DETAIL
  https://phabricator.wikimedia.org/T295601

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: hashar
Cc: hashar, Aklapper, Lucas_Werkmeister_WMDE, karapayneWMDE, Invadibot, 
MPhamWMF, maantietaja, CBogen, Akuckartz, Nandana, Namenlos314, A.S.Kochergin, 
Lahi, Gq86, GoranSMilovanovic, Mahir256, QZanden, EBjune, merbst, LawExplorer, 
Salgo60, _jensen, rosalieper, xSavitar, Scott_WUaS, Jonas, Xmlizer, jkroll, 
Wikidata-bugs, Jdouglas, aude, Tobias1984, Manybubbles, jayvdb, 
Lydia_Pintscher, Paladox, Addshore, Mbch331, Jay8g, Krenair, QChris
_______________________________________________
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org

Reply via email to