]> git.ipfire.org Git - thirdparty/git.git/blobdiff - ref-filter.c
Another batch before -rc1
[thirdparty/git.git] / ref-filter.c
index fd1cb14b0f131de522cd60c71127c9369fe84648..9dc2cd14519d07fb976a3007c1d8d47fa9a9a549 100644 (file)
@@ -1375,12 +1375,12 @@ static void find_subpos(const char *buf,
        /* subject is first non-empty line */
        *sub = buf;
        /* subject goes to first empty line before signature begins */
-       if ((eol = strstr(*sub, "\n\n"))) {
+       if ((eol = strstr(*sub, "\n\n")) ||
+           (eol = strstr(*sub, "\r\n\r\n"))) {
                eol = eol < sigstart ? eol : sigstart;
-       /* check if message uses CRLF */
-       } else if (! (eol = strstr(*sub, "\r\n\r\n"))) {
+       } else {
                /* treat whole message as subject */
-               eol = strrchr(*sub, '\0');
+               eol = sigstart;
        }
        buf = eol;
        *sublen = buf - *sub;
@@ -1722,6 +1722,8 @@ char *get_head_description(void)
        } else
                strbuf_addstr(&desc, _("(no branch)"));
 
+       wt_status_state_free_buffers(&state);
+
        return strbuf_detach(&desc, NULL);
 }