push: only get the branch when needed
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							cc16f95d21
						
					
				
				
					commit
					65c63a0054
				
			@ -243,7 +243,7 @@ static int is_same_remote(struct remote *remote)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void setup_default_push_refspecs(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);
 | 
						int same_remote = is_same_remote(remote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (push_default) {
 | 
						switch (push_default) {
 | 
				
			||||||
@ -259,6 +259,7 @@ static void setup_default_push_refspecs(struct remote *remote)
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						branch = branch_get(NULL);
 | 
				
			||||||
	if (!branch)
 | 
						if (!branch)
 | 
				
			||||||
		die(_(message_detached_head_die), remote->name);
 | 
							die(_(message_detached_head_die), remote->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user