]> git.ipfire.org Git - thirdparty/git.git/blobdiff - wt-status.c
Merge branch 'fs/find-end-of-log-message-fix'
[thirdparty/git.git] / wt-status.c
index 7108a92b52ce06e5674aadfc5c89d05157a9db93..2db4bb3a1293bb69e081efcf98489a63ca2d812a 100644 (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;
 }