From: Dave Borowitz Date: Wed, 01 Jul 2015 18:08:19 GMT Subject: [PATCH 7/7] send-pack.c: Die if the nonce is empty Message-ID: <1435774099-21260-8-git-send-email-dborowitz@google.com> In-Reply-To: <1435774099-21260-1-git-send-email-dborowitz@google.com> pack-protocol.txt does not list the nonce as optional. Fortunately, it should be impossible to not have a nonce by this point in the code, as the caller should have died on line 380 prior to generating a push certificate with an empty nonce. Nonetheless, having this explicit error handling in the code reduces confusion for implementors trying to understand the signed push protocol by looking at the reference implementation. Signed-off-by: Dave Borowitz --- send-pack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/send-pack.c b/send-pack.c index 2a64fec..77e2131 100644 --- a/send-pack.c +++ b/send-pack.c @@ -254,6 +254,8 @@ static int generate_push_cert(struct strbuf *req_buf, } if (push_cert_nonce[0]) strbuf_addf(&cert, "nonce %s\n", push_cert_nonce); + else + die(_("server did not provide a nonce")); strbuf_addstr(&cert, "\n"); for (ref = remote_refs; ref; ref = ref->next) { -- 2.4.3.573.g4eafbef