summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2021-05-31 14:51:23 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-06-02 10:12:02 +0900
commite0c91cffde8477ababb5163180f08e29da54db3e (patch)
tree6d47f62f9f665da129d23ce810b54072a55ef9f6 /builtin/push.c
parentpush: remove trivial function (diff)
downloadtgif-e0c91cffde8477ababb5163180f08e29da54db3e.tar.xz
push: only check same_remote when needed
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/push.c b/builtin/push.c
index a873f8da92..f3916c66d1 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -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: