]> git.ipfire.org Git - thirdparty/git.git/commitdiff
push: only check same_remote when needed
authorFelipe Contreras <felipe.contreras@gmail.com>
Mon, 31 May 2021 19:51:23 +0000 (14:51 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jun 2021 01:12:02 +0000 (10:12 +0900)
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/push.c

index a873f8da9294e107fa11799569a5931d58c31e70..f3916c66d1f270695b5ba49c67c8a65398f9f0ad 100644 (file)
@@ -205,8 +205,8 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
 static void setup_default_push_refspecs(struct remote *remote)
 {
        struct branch *branch;
-       int same_remote = remote == remote_get(NULL);
        const char *dst;
+       int same_remote;
 
        switch (push_default) {
        case PUSH_DEFAULT_MATCHING:
@@ -226,6 +226,7 @@ static void setup_default_push_refspecs(struct remote *remote)
                die(_(message_detached_head_die), remote->name);
 
        dst = branch->refname;
+       same_remote = remote == remote_get(NULL);
 
        switch (push_default) {
        default: