cmd_fetch_pack(): return early if finish_connect() fails
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 9 Sep 2012 06:19:46 +0000 (08:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2012 18:46:31 +0000 (11:46 -0700)
This simplifies the logic without changing the behavior.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch-pack.c
index 056ccb8667110b4f8064ee616c6d64e198106275..fb2a423b5199b807c04ab24e82c90c3c3fbe86b2 100644 (file)
@@ -1018,10 +1018,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
        close(fd[0]);
        close(fd[1]);
        if (finish_connect(conn))
-               ref = NULL;
-       ret = !ref;
+               return 1;
 
-       if (!ret && sought.nr) {
+       ret = !ref;
+       if (ref && sought.nr) {
                /* If the heads to pull were given, we should have
                 * consumed all of them by matching the remote.
                 * Otherwise, 'git fetch remote no-such-ref' would