]> git.ipfire.org Git - thirdparty/git.git/blobdiff - gpg-interface.c
test-ref-store: remove force-create argument for create-reflog
[thirdparty/git.git] / gpg-interface.c
index 800d8caa677d4d2baf4fcd3c8aebf9649650a8b3..3e7255a2a91103323232f55a6ae7770266595f9a 100644 (file)
@@ -387,10 +387,6 @@ static void parse_ssh_output(struct signature_check *sigc)
        line = to_free = xmemdupz(sigc->output, strcspn(sigc->output, "\n"));
 
        if (skip_prefix(line, "Good \"git\" signature for ", &line)) {
-               /* Valid signature and known principal */
-               sigc->result = 'G';
-               sigc->trust_level = TRUST_FULLY;
-
                /* Search for the last "with" to get the full principal */
                principal = line;
                do {
@@ -398,6 +394,12 @@ static void parse_ssh_output(struct signature_check *sigc)
                        if (search)
                                line = search + 1;
                } while (search != NULL);
+               if (line == principal)
+                       goto cleanup;
+
+               /* Valid signature and known principal */
+               sigc->result = 'G';
+               sigc->trust_level = TRUST_FULLY;
                sigc->signer = xmemdupz(principal, line - principal - 1);
        } else if (skip_prefix(line, "Good \"git\" signature with ", &line)) {
                /* Valid signature, but key unknown */
@@ -407,9 +409,9 @@ static void parse_ssh_output(struct signature_check *sigc)
                goto cleanup;
        }
 
-       key = strstr(line, "key");
+       key = strstr(line, "key ");
        if (key) {
-               sigc->fingerprint = xstrdup(strstr(line, "key") + 4);
+               sigc->fingerprint = xstrdup(strstr(line, "key ") + 4);
                sigc->key = xstrdup(sigc->fingerprint);
        } else {
                /*
@@ -775,7 +777,7 @@ static const char *get_default_ssh_signing_key(void)
                if (keys[0] && starts_with(keys[0]->buf, "ssh-")) {
                        default_key = strbuf_detach(keys[0], NULL);
                } else {
-                       warning(_("gpg.ssh.defaultKeycommand succeeded but returned no keys: %s %s"),
+                       warning(_("gpg.ssh.defaultKeyCommand succeeded but returned no keys: %s %s"),
                                key_stderr.buf, key_stdout.buf);
                }