Merge branch 'dk/blame-move-no-reason-for-1-line-context' into maint
[gitweb.git] / commit.c
index 24d4715f24f06c4747eb728ffbdab2aadf715e6a..2a90e37519f0b6e9de6e30ed57afe91822441ca3 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1092,9 +1092,14 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
 {
        struct strbuf sig = STRBUF_INIT;
        int inspos, copypos;
+       const char *eoh;
 
        /* find the end of the header */
-       inspos = strstr(buf->buf, "\n\n") - buf->buf + 1;
+       eoh = strstr(buf->buf, "\n\n");
+       if (!eoh)
+               inspos = buf->len;
+       else
+               inspos = eoh - buf->buf + 1;
 
        if (!keyid || !*keyid)
                keyid = get_signing_key();