diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-06-05 09:03:13 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-05 09:03:13 +0900 |
commit | 00c0e40f020581ff010a3efd96243bf0ae726fb0 (patch) | |
tree | b2da71224902e8bae1834bf1baf91a7dbc34f20a /wt-status.c | |
parent | fd8567c99023c62ca206d930dfbf41a92648ea9a (diff) | |
parent | d76650b8d16c9e5e7b6ee94e6922a3b99be74746 (diff) | |
download | git-00c0e40f020581ff010a3efd96243bf0ae726fb0.tar.gz |
Merge branch 'bm/interpret-trailers-cut-line-is-eom' into maint
"git interpret-trailers", when used as GIT_EDITOR for "git commit
-v", looked for and appended to a trailer block at the very end,
i.e. at the end of the "diff" output. The command has been
corrected to pay attention to the cut-mark line "commit -v" adds to
the buffer---the real trailer block should appear just before it.
* bm/interpret-trailers-cut-line-is-eom:
interpret-trailers: honor the cut line
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/wt-status.c b/wt-status.c index 117ac8cfb0..068de38b51 100644 --- a/wt-status.c +++ b/wt-status.c @@ -896,17 +896,18 @@ conclude: status_printf_ln(s, GIT_COLOR_NORMAL, "%s", ""); } -void wt_status_truncate_message_at_cut_line(struct strbuf *buf) +size_t wt_status_locate_end(const char *s, size_t len) { const char *p; struct strbuf pattern = STRBUF_INIT; 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); + if (starts_with(s, pattern.buf + 1)) + len = 0; + else if ((p = strstr(s, pattern.buf))) + len = p - s + 1; strbuf_release(&pattern); + return len; } void wt_status_add_cut_line(FILE *fp) |