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
This commit is contained in:
Junio C Hamano
2017-06-05 09:03:13 +09:00
5 changed files with 32 additions and 13 deletions

View File

@ -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)