]> Pileus Git - ~andy/git/blobdiff - commit.c
Update draft release notes to 1.8.3
[~andy/git] / commit.c
index 66a3f4e8f42069f23f25b04b10a6a6d46f6780c2..516a4ff7d21d5ebcfabda7b1b886eb10b05cebfc 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1047,6 +1047,8 @@ static struct {
 } sigcheck_gpg_status[] = {
        { 'G', "\n[GNUPG:] GOODSIG " },
        { 'B', "\n[GNUPG:] BADSIG " },
+       { 'U', "\n[GNUPG:] TRUST_NEVER" },
+       { 'U', "\n[GNUPG:] TRUST_UNDEFINED" },
 };
 
 static void parse_gpg_output(struct signature_check *sigc)
@@ -1054,18 +1056,27 @@ static void parse_gpg_output(struct signature_check *sigc)
        const char *buf = sigc->gpg_status;
        int i;
 
+       /* Iterate over all search strings */
        for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
-               const char *found = strstr(buf, sigcheck_gpg_status[i].check);
-               const char *next;
-               if (!found)
-                       continue;
+               const char *found, *next;
+
+               if (!prefixcmp(buf, sigcheck_gpg_status[i].check + 1)) {
+                       /* At the very beginning of the buffer */
+                       found = buf + strlen(sigcheck_gpg_status[i].check + 1);
+               } else {
+                       found = strstr(buf, sigcheck_gpg_status[i].check);
+                       if (!found)
+                               continue;
+                       found += strlen(sigcheck_gpg_status[i].check);
+               }
                sigc->result = sigcheck_gpg_status[i].result;
-               found += strlen(sigcheck_gpg_status[i].check);
-               sigc->key = xmemdupz(found, 16);
-               found += 17;
-               next = strchrnul(found, '\n');
-               sigc->signer = xmemdupz(found, next - found);
-               break;
+               /* The trust messages are not followed by key/signer information */
+               if (sigc->result != 'U') {
+                       sigc->key = xmemdupz(found, 16);
+                       found += 17;
+                       next = strchrnul(found, '\n');
+                       sigc->signer = xmemdupz(found, next - found);
+               }
        }
 }