From: Felipe Contreras Date: Mon, 31 May 2021 19:51:16 +0000 (-0500) Subject: push: only get the branch when needed X-Git-Tag: v2.33.0-rc0~68^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65c63a005434306e7c064eb463ff1f61de56d38e;p=thirdparty%2Fgit.git push: only get the branch when needed Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- diff --git a/builtin/push.c b/builtin/push.c index 8fcbd2878d..d9f9d20f39 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -243,7 +243,7 @@ static int is_same_remote(struct remote *remote) static void setup_default_push_refspecs(struct remote *remote) { - struct branch *branch = branch_get(NULL); + struct branch *branch; int same_remote = is_same_remote(remote); switch (push_default) { @@ -259,6 +259,7 @@ static void setup_default_push_refspecs(struct remote *remote) break; } + branch = branch_get(NULL); if (!branch) die(_(message_detached_head_die), remote->name);