summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/push.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/push.c b/builtin/push.c
index ef3aa97..ba2bd56 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -175,6 +175,8 @@ static void warn_unspecified_push_default_configuration(void)
static void setup_default_push_refspecs(struct remote *remote)
{
+ struct branch *branch;
+
switch (push_default) {
default:
case PUSH_DEFAULT_UNSPECIFIED:
@@ -194,6 +196,9 @@ static void setup_default_push_refspecs(struct remote *remote)
break;
case PUSH_DEFAULT_CURRENT:
+ branch = branch_get(NULL);
+ if (!branch)
+ die(_(message_detached_head_die), remote->name);
add_refspec("HEAD");
break;