summaryrefslogtreecommitdiff
path: root/builtin/mailinfo.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2012-01-16 10:53:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-17 00:06:57 (GMT)
commitee2d1cb402a7ccda0028b221f2252801b3cb7eef (patch)
treed2b20ac5795f6a85820a672c397389d5ac6a64d0 /builtin/mailinfo.c
parentf7e5ea171b693bf5fc88e059d9d4af3753c09143 (diff)
downloadgit-ee2d1cb402a7ccda0028b221f2252801b3cb7eef.zip
git-ee2d1cb402a7ccda0028b221f2252801b3cb7eef.tar.gz
git-ee2d1cb402a7ccda0028b221f2252801b3cb7eef.tar.bz2
mailinfo: with -b, keep space after [foo]
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>
Diffstat (limited to 'builtin/mailinfo.c')
-rw-r--r--builtin/mailinfo.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index bfb32b7..eaf9e15 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -250,8 +250,17 @@ static void cleanup_subject(struct strbuf *subject)
(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;