1 | ---
|
---|
2 | builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
|
---|
3 | 1 files changed, 36 insertions(+), 1 deletions(-)
|
---|
4 |
|
---|
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)
|
---|
10 | return 0;
|
---|
11 | }
|
---|
12 |
|
---|
13 | +static int scissors(const struct strbuf *line)
|
---|
14 | +{
|
---|
15 | + size_t i, len = line->len;
|
---|
16 | + int scissors_dashes_seen = 0;
|
---|
17 | + const char *buf = line->buf;
|
---|
18 | +
|
---|
19 | + for (i = 0; i < len; i++) {
|
---|
20 | + if (isspace(buf[i]))
|
---|
21 | + continue;
|
---|
22 | + if (buf[i] == '-') {
|
---|
23 | + scissors_dashes_seen |= 02;
|
---|
24 | + continue;
|
---|
25 | + }
|
---|
26 | + if (i + 1 < len && !memcmp(buf + i, ">8", 2)) {
|
---|
27 | + scissors_dashes_seen |= 01;
|
---|
28 | + i++;
|
---|
29 | + continue;
|
---|
30 | + }
|
---|
31 | + if (i + 7 < len && !memcmp(buf + i, "cut here", 8)) {
|
---|
32 | + i += 7;
|
---|
33 | + continue;
|
---|
34 | + }
|
---|
35 | + /* everything else --- not scissors */
|
---|
36 | + break;
|
---|
37 | + }
|
---|
38 | + return scissors_dashes_seen == 03;
|
---|
39 | +}
|
---|
40 | +
|
---|
41 | static int handle_commit_msg(struct strbuf *line)
|
---|
42 | {
|
---|
43 | static int still_looking = 1;
|
---|
44 | @@ -723,10 +751,17 @@ static int handle_commit_msg(struct strbuf *line)
|
---|
45 | strbuf_ltrim(line);
|
---|
46 | if (!line->len)
|
---|
47 | return 0;
|
---|
48 | - if ((still_looking = check_header(line, s_hdr_data, 0)) != 0)
|
---|
49 | + still_looking = check_header(line, s_hdr_data, 0);
|
---|
50 | + if (still_looking)
|
---|
51 | return 0;
|
---|
52 | }
|
---|
53 |
|
---|
54 | + if (scissors(line)) {
|
---|
55 | + fseek(cmitmsg, 0L, SEEK_SET);
|
---|
56 | + still_looking = 1;
|
---|
57 | + return 0;
|
---|
58 | + }
|
---|
59 | +
|
---|
60 | /* normalize the log message to UTF-8. */
|
---|
61 | if (metainfo_charset)
|
---|
62 | convert_to_utf8(line, charset.buf);
|
---|
63 | --
|
---|
64 | 1.6.4.1
|
---|