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:
Junio C Hamano
2024-03-21 14:55:12 -07:00
2 changed files with 19 additions and 2 deletions

View File

@ -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);
if (starts_with(s, pattern.buf + 1))
len = 0;
else if ((p = strstr(s, pattern.buf)))
len = p - s + 1;
else if ((p = strstr(s, pattern.buf))) {
size_t newlen = p - s + 1;
if (newlen < len)
len = newlen;
}
strbuf_release(&pattern);
return len;
}