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>
Felipe Contreras committed
May 31, 2021 at 14:51 UTC
e0c91cffde8477ababb5163180f08e29da54db3e
1 file changed
+2
-1
builtin/push.c
+2
-1
@@ -205,8 +205,8 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
205
static void setup_default_push_refspecs(struct remote *remote)
206
{
207
struct branch *branch;
208
- int same_remote = remote == remote_get(NULL);
208
const char *dst;
209
+ int same_remote;
210
211
switch (push_default) {
212
case PUSH_DEFAULT_MATCHING:
@@ -226,6 +226,7 @@ static void setup_default_push_refspecs(struct remote *remote)
226
die(_(message_detached_head_die), remote->name);
227
228
dst = branch->refname;
229
+ same_remote = remote == remote_get(NULL);
230
231
switch (push_default) {
232
default: