On Sat, Sep 08, 2012 at 04:10:59PM +0200, Robin Stocker wrote:
> > > 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.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html