Re: [PATCH] cherry-pick: Append -x line on separate paragraph
- From
Jeff King <peff@peff.net>
- Date
- Sep 10, 2012, 16:27 UTC
- Message-ID
- <20120910162754.GD9435@sigill.intra.peff.net>
- In-Reply-To
- <1498324622.1357.1347113459304.JavaMail.root@bazinga.schuettel.ch>
On Sat, Sep 08, 2012 at 04:10:59PM +0200, Robin Stocker wrote:
Show 9 quoted lines
> > > Maybe the solution is to detect if the original commit message > > > ends with a trailer and in that case keep the existing behavior > > > of not inserting a blank line? > > > > Yeah, that sounds like a good change from "this makes the result > > look better" point of view. > > How do you think we could best detect a tailer? Check if all > lines of the last paragraph start with /[\w-]+: /?
There is ends_rfc2822_footer() in builtin/commit.c, which is currently used for adding Signed-off-by lines. It might make sense to factor that out, and have a new:
add_pseudoheader(struct strbuf *commit_message,
const char *header)that would implement the same set of spacing rules for signed-off-by, cherry-picked-from, and anything else we end up adding later.
I think pseudo-headers like these might also want duplicate suppression of the final line, which could be part of that function. Note that you would not want to suppress a duplicate line from the middle of the trailer, since you might want to sign-off twice (e.g., you sign-off the original, and then also the cherry-pick). But you would not want two duplicate lines at the end saying "Signed-off-by: ...", and I believe "git commit" already suppresses those duplicates.
> I'm going to work on this and submit a new version of the patch. The > "Cherry-picked-from" change could then be made later on top of that.
Yay. This has come up more than once over the years, so I am glad to see somebody working on it.
-Peff