2 builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
3 1 files changed, 36 insertions(+), 1 deletions(-)
5 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
6 index b0b5d8f..461c47e 100644
7 --- a/builtin-mailinfo.c
8 +++ b/builtin-mailinfo.c
9 @@ -712,6 +712,34 @@ static inline int patchbreak(const struct strbuf *line)
13 +static int scissors(const struct strbuf *line)
15 + size_t i, len = line->len;
16 + int scissors_dashes_seen = 0;
17 + const char *buf = line->buf;
19 + for (i = 0; i < len; i++) {
20 + if (isspace(buf[i]))
22 + if (buf[i] == '-') {
23 + scissors_dashes_seen |= 02;
26 + if (i + 1 < len && !memcmp(buf + i, ">8", 2)) {
27 + scissors_dashes_seen |= 01;
31 + if (i + 7 < len && !memcmp(buf + i, "cut here", 8)) {
35 + /* everything else --- not scissors */
38 + return scissors_dashes_seen == 03;
41 static int handle_commit_msg(struct strbuf *line)
43 static int still_looking = 1;
44 @@ -723,10 +751,17 @@ static int handle_commit_msg(struct strbuf *line)
48 - if ((still_looking = check_header(line, s_hdr_data, 0)) != 0)
49 + still_looking = check_header(line, s_hdr_data, 0);
54 + if (scissors(line)) {
55 + fseek(cmitmsg, 0L, SEEK_SET);
60 /* normalize the log message to UTF-8. */
62 convert_to_utf8(line, charset.buf);