diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-03 10:41:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 10:41:30 -0700 |
commit | a94594dcf7522652363773c06e1ff617914dffe8 (patch) | |
tree | 26e106482d98545d8e6d4cb4cb8da48dee14e877 /wt-status.c | |
parent | ca00f80b58d679e59fc271650f68cd25cdb72b09 (diff) | |
parent | fbfa0973faf47e475854a8919097d5db29acf536 (diff) | |
download | git-a94594dcf7522652363773c06e1ff617914dffe8.tar.gz |
Merge branch 'sg/commit-cleanup-scissors' into maint
"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.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c index 38cb165f12..078a472743 100644 --- a/wt-status.c +++ b/wt-status.c @@ -823,10 +823,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); } |