{"thread":{"id":"52021","subject":"Adding a line after the signed-off git am -s","startedAt":"2019-10-11T14:43:55Z","lastAt":"2019-10-16T08:48:51Z","messageCount":4,"participants":["Daniel Lezcano","Junio C Hamano","Beat Bolli"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"383890","messageId":"6797ef7d-5444-4c77-59e6-1d78fd3ccb0c@linaro.org","threadId":"52021","inReplyTo":null,"subject":"Adding a line after the signed-off git am -s","fromName":"Daniel Lezcano","fromEmail":"daniel.lezcano@linaro.org","sentAt":"2019-10-11T14:43:45Z","receivedAt":"2019-10-11T14:43:55Z","isPatch":false,"sender":{"key":"daniel.lezcano@linaro.org","avatar":null},"body":"\nHi all,\n\nIs there a way to specify a line to be added in the change-log after the\nSOB with git-am ?\n\nI would like to do something:\n\ngit am -s -l \"Link: https://lore.kernel.org/r/<msgid>\"\n\nWhich will give:\n\nblabla\n\nSigned-off-by: author@kairnail.org\nSigned-off-by: commiter@kairnail.org\nLink: https://lore.kernel.org/r/<msgid>\n\nThis way it is compatible with patchwork, git-pw, etc...\n\nThanks in advance\n\n-- \n <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs\n\nFollow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |\n<http://twitter.com/#!/linaroorg> Twitter |\n<http://www.linaro.org/linaro-blog/> Blog\n\n"},{"id":"383957","messageId":"xmqq7e5ag4g5.fsf@gitster-ct.c.googlers.com","threadId":"52021","inReplyTo":"6797ef7d-5444-4c77-59e6-1d78fd3ccb0c@linaro.org","subject":"Re: Adding a line after the signed-off git am -s","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-12T01:03:54Z","receivedAt":"2019-10-12T01:04:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Lezcano <daniel.lezcano@linaro.org> writes:\n\n> I would like to do something:\n>\n> git am -s -l \"Link: https://lore.kernel.org/r/<msgid>\"\n>\n> Which will give:\n>\n> blabla\n>\n> Signed-off-by: author@kairnail.org\n> Signed-off-by: commiter@kairnail.org\n> Link: https://lore.kernel.org/r/<msgid>\n>\n> This way it is compatible with patchwork, git-pw, etc...\n\nThere is the post-applypatch hook you can define after the patch\ngets applied and produces a commit.\n\nI use it to maintain the amlog notes in my repository (iow, I do not\namend the commit, but add notes to the resulting commit so that I\ncan tell, given a commit, which message resulted in it).  \n\nIf you want to amend the resulting commit instead, the place to do\nso would be where I call \"git notes --ref amlog\" in the sample\nscript.\n\n-- >8 -- post-applypatch hook example -- >8 --\n#!/bin/sh\n\nGIT_DIR=.git\ndotest=\"$GIT_DIR/rebase-apply\"\n\nprec=4 &&\nthis=$(cat 2>/dev/null \"$dotest/next\") &&\nmsgnum=$(printf \"%0${prec}d\" $this) &&\ntest -f \"$dotest/$msgnum\" &&\nmessage_id=$(sed -ne '\n\t/^[ \t]/{\n\t\t# Append continuation line to hold space\n\t\tH\n\t\t# Swap hold and pattern\n\t\tx\n\t\t# Remove the LF, making it a single line\n\t\ts/\\n//\n\t\t# Swap hold and pattern back\n\t\tx\n\t\t# Discard the pattern and go on\n\t\tn\n\t}\n\t# Hold this new line, and look at what is in the hold space\n\tx\n\t# Is it the Message-ID line?  If so, spit it out and finish.\n\t/^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:[ \t]*/{\n\t\ts///p\n\t\tq\n\t}\n\t# Otherwise, check if this new line is empty\n\tx\n\t# Is it?  Then we are done with the header\n\t/^$/b end\n\t# Otherwise we need to hold onto this header line\n\tx\n\t# And start the next cycle\n\tb\n: end\n\t# ??? do we want to check if we held onto the last message-id line\n\t# and process it here if we did???\n\tq\n' \"$dotest/$msgnum\") &&\n\nif\ttest -n \"$message_id\" &&\n\thead=$(git rev-parse --verify HEAD 2>/dev/null)\nthen\n\techo \"$head $message_id\" >>\"$GIT_DIR\"/am.log &&\n\tgit notes --ref amlog add -f -m \"Message-Id: $message_id\" \"$head\"\nfi\n"},{"id":"384119","messageId":"8089dfce-0183-b7fb-cab8-0a71404b6584@drbeat.li","threadId":"52021","inReplyTo":"6797ef7d-5444-4c77-59e6-1d78fd3ccb0c@linaro.org","subject":"Re: Adding a line after the signed-off git am -s","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-10-15T22:52:32Z","receivedAt":"2019-10-15T22:59:05Z","isPatch":false,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 11.10.19 16:43, Daniel Lezcano wrote:\n> \n> Hi all,\n> \n> Is there a way to specify a line to be added in the change-log after the\n> SOB with git-am ?\n> \n> I would like to do something:\n> \n> git am -s -l \"Link: https://lore.kernel.org/r/<msgid>\"\n> \n> Which will give:\n> \n> blabla\n> \n> Signed-off-by: author@kairnail.org\n> Signed-off-by: commiter@kairnail.org\n> Link: https://lore.kernel.org/r/<msgid>\n> \n> This way it is compatible with patchwork, git-pw, etc...\n\nI think something like\n\n    git interpret-trailer --trailer Link:https://lore.kernel.irg/r/msgid\n<patch | git am -\n\nshould work.\n\n\nCheers,\nBeat\n"},{"id":"384169","messageId":"c82cf831-a033-1ad9-139b-4cbc1eb3fb1d@linaro.org","threadId":"52021","inReplyTo":"8089dfce-0183-b7fb-cab8-0a71404b6584@drbeat.li","subject":"Re: Adding a line after the signed-off git am -s","fromName":"Daniel Lezcano","fromEmail":"daniel.lezcano@linaro.org","sentAt":"2019-10-16T08:48:33Z","receivedAt":"2019-10-16T08:48:51Z","isPatch":false,"sender":{"key":"daniel.lezcano@linaro.org","avatar":null},"body":"On 16/10/2019 00:52, Beat Bolli wrote:\n> On 11.10.19 16:43, Daniel Lezcano wrote:\n>>\n>> Hi all,\n>>\n>> Is there a way to specify a line to be added in the change-log after the\n>> SOB with git-am ?\n>>\n>> I would like to do something:\n>>\n>> git am -s -l \"Link: https://lore.kernel.org/r/<msgid>\"\n>>\n>> Which will give:\n>>\n>> blabla\n>>\n>> Signed-off-by: author@kairnail.org\n>> Signed-off-by: commiter@kairnail.org\n>> Link: https://lore.kernel.org/r/<msgid>\n>>\n>> This way it is compatible with patchwork, git-pw, etc...\n> \n> I think something like\n> \n>     git interpret-trailer --trailer Link:https://lore.kernel.irg/r/msgid\n> <patch | git am -\n> \n> should work.\n\nThank you for the suggestion, I will try.\n\n  -- Daniel\n\n\n-- \n <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs\n\nFollow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |\n<http://twitter.com/#!/linaroorg> Twitter |\n<http://www.linaro.org/linaro-blog/> Blog\n\n"}]}