aboutsummaryrefslogtreecommitdiff
path: root/builtin-mailinfo.c
diff options
context:
space:
mode:
authorLukas Sandström <luksan@gmail.com>2009-11-20 17:12:47 +0100
committerJunio C Hamano <gitster@pobox.com>2009-11-20 23:14:02 -0800
commitd25e51596be9271ad833805a3d6f9012dc24ee79 (patch)
treed0f40af3fc5da0c97602a2def6cdeeec10e71318 /builtin-mailinfo.c
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-d25e51596be9271ad833805a3d6f9012dc24ee79.tar.gz
git-d25e51596be9271ad833805a3d6f9012dc24ee79.tar.xz
git am/mailinfo: Don't look at in-body headers when rebasing
When we are rebasing we know that the header lines in the patch are good and that we don't need to pick up any headers from the body of the patch. This makes it possible to rebase commits whose commit message start with "From" or "Date". Test vectors by Jeff King. Signed-off-by: Lukas Sandström <luksan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-mailinfo.c')
-rw-r--r--builtin-mailinfo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index c90cd312a..3c4f0753f 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -26,6 +26,7 @@ static struct strbuf charset = STRBUF_INIT;
static int patch_lines;
static struct strbuf **p_hdr_data, **s_hdr_data;
static int use_scissors;
+static int use_inbody_headers = 1;
#define MAX_HDR_PARSED 10
#define MAX_BOUNDARIES 5
@@ -774,10 +775,17 @@ static int handle_commit_msg(struct strbuf *line)
strbuf_ltrim(line);
if (!line->len)
return 0;
+ }
+
+ if (use_inbody_headers && still_looking) {
still_looking = check_header(line, s_hdr_data, 0);
if (still_looking)
return 0;
- }
+ } else
+ /* Only trim the first (blank) line of the commit message
+ * when ignoring in-body headers.
+ */
+ still_looking = 0;
/* normalize the log message to UTF-8. */
if (metainfo_charset)
@@ -1033,6 +1041,8 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
use_scissors = 1;
else if (!strcmp(argv[1], "--no-scissors"))
use_scissors = 0;
+ else if (!strcmp(argv[1], "--no-inbody-headers"))
+ use_inbody_headers = 0;
else
usage(mailinfo_usage);
argc--; argv++;