mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
Merge branch 'fs/find-end-of-log-message-fix'
The code to find the effective end of log message can fall into an endless loop, which has been corrected. * fs/find-end-of-log-message-fix: wt-status: don't find scissors line beyond buf len
This commit is contained in:
commit
8be51c1f36
|
@ -1935,4 +1935,18 @@ test_expect_success 'suppressing --- does not disable cut-line handling' '
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'handling of --- lines in conjunction with cut-lines' '
|
||||||
|
echo "my-trailer: here" >expected &&
|
||||||
|
|
||||||
|
git interpret-trailers --parse >actual <<-\EOF &&
|
||||||
|
subject
|
||||||
|
|
||||||
|
my-trailer: here
|
||||||
|
---
|
||||||
|
# ------------------------ >8 ------------------------
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
@ -1093,8 +1093,11 @@ size_t wt_status_locate_end(const char *s, size_t len)
|
||||||
strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
|
strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
|
||||||
if (starts_with(s, pattern.buf + 1))
|
if (starts_with(s, pattern.buf + 1))
|
||||||
len = 0;
|
len = 0;
|
||||||
else if ((p = strstr(s, pattern.buf)))
|
else if ((p = strstr(s, pattern.buf))) {
|
||||||
len = p - s + 1;
|
size_t newlen = p - s + 1;
|
||||||
|
if (newlen < len)
|
||||||
|
len = newlen;
|
||||||
|
}
|
||||||
strbuf_release(&pattern);
|
strbuf_release(&pattern);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue