From 662cc30cd048f2ccd7ba8d1540e0768ae264c0dd Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 20 Sep 2013 06:16:28 -0400 Subject: format-patch: print in-body "From" only when needed Commit a908047 taught format-patch the "--from" option, which places the author ident into an in-body from header, and uses the committer ident in the rfc822 from header. The documentation claims that it will omit the in-body header when it is the same as the rfc822 header, but the code never implemented that behavior. This patch completes the feature by comparing the two idents and doing nothing when they are the same (this is the same as simply omitting the in-body header, as the two are by definition indistinguishable in this case). This makes it reasonable to turn on "--from" all the time (if it matches your particular workflow), rather than only using it when exporting other people's patches. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- cache.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index dd0fb33a15..153081cfe2 100644 --- a/cache.h +++ b/cache.h @@ -963,6 +963,15 @@ struct ident_split { */ extern int split_ident_line(struct ident_split *, const char *, int); +/* + * Compare split idents for equality or strict ordering. Note that we + * compare only the ident part of the line, ignoring any timestamp. + * + * Because there are two fields, we must choose one as the primary key; we + * currently arbitrarily pick the email. + */ +extern int ident_cmp(const struct ident_split *, const struct ident_split *); + struct checkout { const char *base_dir; int base_dir_len; -- cgit v1.2.1