diff options
author | Fabian Stelzer <fs@gigacodes.de> | 2022-03-04 10:25:17 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-04 19:36:40 (GMT) |
commit | a075e79d2c036e8e41900cfcb2177d75b92758c8 (patch) | |
tree | 3acec668585f175d18a5dacf092e26c49ea3bbfb /gpg-interface.c | |
parent | 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a (diff) | |
download | git-a075e79d2c036e8e41900cfcb2177d75b92758c8.zip git-a075e79d2c036e8e41900cfcb2177d75b92758c8.tar.gz git-a075e79d2c036e8e41900cfcb2177d75b92758c8.tar.bz2 |
gpg-interface/gpgsm: fix for v2.3
Checking if signing was successful will now accept '[GNUPG]:
SIG_CREATED' on the beginning of the first or any subsequent line. Not
just explictly the second one anymore.
Gpgsm v2.3 changed its output when listing keys from `fingerprint` to
`sha1/2 fpr`. This leads to the gpgsm tests silently not being executed
because of a failed prerequisite.
Switch to gpg's `--with-colons` output format when evaluating test
prerequisites to make parsing more robust. This also allows us to
combine the existing grep/cut/tr/echo pipe for writing the trustlist.txt
into a single awk expression.
Adjust error message checking in test for v2.3 specific output changes.
Helped-By: Junio C Hamano <gitster@pobox.com>
Helped-By: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gpg-interface.c')
-rw-r--r-- | gpg-interface.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gpg-interface.c b/gpg-interface.c index b52eb0e..4238e60 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -920,6 +920,7 @@ static int sign_buffer_gpg(struct strbuf *buffer, struct strbuf *signature, struct child_process gpg = CHILD_PROCESS_INIT; int ret; size_t bottom; + const char *cp; struct strbuf gpg_status = STRBUF_INIT; strvec_pushl(&gpg.args, @@ -939,7 +940,13 @@ static int sign_buffer_gpg(struct strbuf *buffer, struct strbuf *signature, signature, 1024, &gpg_status, 0); sigchain_pop(SIGPIPE); - ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED "); + for (cp = gpg_status.buf; + cp && (cp = strstr(cp, "[GNUPG:] SIG_CREATED ")); + cp++) { + if (cp == gpg_status.buf || cp[-1] == '\n') + break; /* found */ + } + ret |= !cp; strbuf_release(&gpg_status); if (ret) return error(_("gpg failed to sign the data")); |