Skip to content

Commit 65c63a0

Browse files
felipecgitster
authored andcommitted
push: only get the branch when needed
Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cc16f95 commit 65c63a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/push.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int is_same_remote(struct remote *remote)
243243

244244
static void setup_default_push_refspecs(struct remote *remote)
245245
{
246-
struct branch *branch = branch_get(NULL);
246+
struct branch *branch;
247247
int same_remote = is_same_remote(remote);
248248

249249
switch (push_default) {
@@ -259,6 +259,7 @@ static void setup_default_push_refspecs(struct remote *remote)
259259
break;
260260
}
261261

262+
branch = branch_get(NULL);
262263
if (!branch)
263264
die(_(message_detached_head_die), remote->name);
264265

0 commit comments

Comments
 (0)