summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7e5ea1)
raw | patch | inline | side by side (parent: f7e5ea1)
author | Thomas Rast <trast@student.ethz.ch> | |
Mon, 16 Jan 2012 10:53:01 +0000 (11:53 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 17 Jan 2012 00:06:57 +0000 (16:06 -0800) |
The logic for the -b mode, where [PATCH] is dropped but [foo] is not,
silently ate all spaces after the ].
Fix this by keeping the next isspace() character, if there is any.
Being more thorough is pointless, as the later cleanup_space() call
will normalize any sequence of whitespace to a single ' '.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
silently ate all spaces after the ].
Fix this by keeping the next isspace() character, if there is any.
Being more thorough is pointless, as the later cleanup_space() call
will normalize any sequence of whitespace to a single ' '.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mailinfo.c | patch | blob | history | |
t/t4150-am.sh | patch | blob | history |
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index bfb32b7233850a68bdc226038a9c0f973037499b..eaf9e157a3897c2442756911b906ff9d3ee2be90 100644 (file)
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
(7 <= remove &&
memmem(subject->buf + at, remove, "PATCH", 5)))
strbuf_remove(subject, at, remove);
- else
+ else {
at += remove;
+ /*
+ * If the input had a space after the ], keep
+ * it. We don't bother with finding the end of
+ * the space, since we later normalize it
+ * anyway.
+ */
+ if (isspace(subject->buf[at]))
+ at += 1;
+ }
continue;
}
break;
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index efcff3c51db4deed371b85acdf5385cc74921809..a087254f644c05591f23232c134bf2930953b764 100755 (executable)
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
grep "Re: Re: Re: \[PATCH 1/5 v2\] \[foo\] third" actual
'
-test_expect_failure 'am --keep-non-patch really keeps the non-patch part' '
+test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
rm -fr .git/rebase-apply &&
git reset --hard &&
git checkout HEAD^ &&