diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-05-29 12:34:52 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-29 12:34:53 +0900 |
commit | 965993d1ef59fe1667a0e32c213569be6a6535af (patch) | |
tree | 6196e62d9e95924e8a4b224e3452046568cc227a /wt-status.c | |
parent | 6f7f11f7aa7b95c1555cd389a219f76ee30b5cc7 (diff) | |
parent | d76650b8d16c9e5e7b6ee94e6922a3b99be74746 (diff) | |
download | git-965993d1ef59fe1667a0e32c213569be6a6535af.tar.gz |
Merge branch 'bm/interpret-trailers-cut-line-is-eom'
"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 c43d17355c..25aafc35c8 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) |