summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-06-24 12:21:55 -0700
committerJunio C Hamano <gitster@pobox.com>2015-06-24 12:21:55 -0700
commit07528be1018b72e463404624b8752ead7eb0eb8d (patch)
tree5d08b81961e129a3d8c42f3ecd23ceec83b08f1b /wt-status.c
parent712b351bd37d4e4676d1165993cad4cc2176b346 (diff)
parentfbfa0973faf47e475854a8919097d5db29acf536 (diff)
downloadgit-07528be1018b72e463404624b8752ead7eb0eb8d.tar.gz
Merge branch 'sg/commit-cleanup-scissors'
"git commit --cleanup=scissors" was not careful enough to protect against getting fooled by a line that looked like scissors. * sg/commit-cleanup-scissors: commit: cope with scissors lines in commit message
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c
index c56c78fb6f..eaed4fed32 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -825,10 +825,11 @@ void wt_status_truncate_message_at_cut_line(struct strbuf *buf)
const char *p;
struct strbuf pattern = STRBUF_INIT;
- strbuf_addf(&pattern, "%c %s", comment_line_char, cut_line);
- p = strstr(buf->buf, pattern.buf);
- if (p && (p == buf->buf || p[-1] == '\n'))
- strbuf_setlen(buf, p - buf->buf);
+ strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
+ if (starts_with(buf->buf, pattern.buf + 1))
+ strbuf_setlen(buf, 0);
+ else if ((p = strstr(buf->buf, pattern.buf)))
+ strbuf_setlen(buf, p - buf->buf + 1);
strbuf_release(&pattern);
}