If the server is configured to not advertise push certificates,
a push certificate that gets pushed nevertheless will not be fully
recorded because push_cert_nonce is NULL.

The recording of GIT_PUSH_CERT_NONCE_STATUS should be dependent on
the status being there instead of push_cert_nonce being non NULL.

Without this patch an unsolicited nonce never makes to the stage when
being exported with GIT_PUSH_CERT_NONCE_STATUS, because in the unsolicited
case push_cert_nonce is always NULL.

Signed-off-by: Stefan Beller <[email protected]>
---
 builtin/receive-pack.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 628d13a..0e4878e 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -504,18 +504,18 @@ static void prepare_push_cert_sha1(struct child_process 
*proc)
                                 sigcheck.key ? sigcheck.key : "");
                argv_array_pushf(&proc->env_array, "GIT_PUSH_CERT_STATUS=%c",
                                 sigcheck.result);
-               if (push_cert_nonce) {
+               if (push_cert_nonce)
                        argv_array_pushf(&proc->env_array,
                                         "GIT_PUSH_CERT_NONCE=%s",
                                         push_cert_nonce);
+               if (nonce_status)
                        argv_array_pushf(&proc->env_array,
                                         "GIT_PUSH_CERT_NONCE_STATUS=%s",
                                         nonce_status);
-                       if (nonce_status == NONCE_SLOP)
-                               argv_array_pushf(&proc->env_array,
-                                                "GIT_PUSH_CERT_NONCE_SLOP=%ld",
-                                                nonce_stamp_slop);
-               }
+               if (nonce_status == NONCE_SLOP)
+                       argv_array_pushf(&proc->env_array,
+                                        "GIT_PUSH_CERT_NONCE_SLOP=%ld",
+                                        nonce_stamp_slop);
        }
 }
 
-- 
2.2.1.62.g3f15098

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to