summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-17 23:11:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-17 23:11:07 (GMT)
commitaf04b1171b9ed16f5acce0a49fe3bda518a40b7e (patch)
treef86d78c39008512fa399fbf20157ffac13d53190 /builtin
parent943c9a7b867210f283d588e1b790d0197b66fde8 (diff)
parentb284495e93394394f7c7923f6d646947844cec04 (diff)
downloadgit-af04b1171b9ed16f5acce0a49fe3bda518a40b7e.zip
git-af04b1171b9ed16f5acce0a49fe3bda518a40b7e.tar.gz
git-af04b1171b9ed16f5acce0a49fe3bda518a40b7e.tar.bz2
Merge branch 'jc/push-default-explicit' into maint
A lazy "git push" without refspec did not internally use a fully specified refspec to perform 'current', 'simple', or 'upstream' push, causing unnecessary "ambiguous ref" errors. * jc/push-default-explicit: push: test pushing ambiguously named branches push: do not use potentially ambiguous default refspec
Diffstat (limited to 'builtin')
-rw-r--r--builtin/push.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/push.c b/builtin/push.c
index 3bb9d6b..9307ad5 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -194,15 +194,18 @@ static void setup_push_upstream(struct remote *remote, struct branch *branch,
die_push_simple(branch, remote);
}
- strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
+ strbuf_addf(&refspec, "%s:%s", branch->refname, branch->merge[0]->src);
add_refspec(refspec.buf);
}
static void setup_push_current(struct remote *remote, struct branch *branch)
{
+ struct strbuf refspec = STRBUF_INIT;
+
if (!branch)
die(_(message_detached_head_die), remote->name);
- add_refspec(branch->name);
+ strbuf_addf(&refspec, "%s:%s", branch->refname, branch->refname);
+ add_refspec(refspec.buf);
}
static int is_workflow_triangular(struct remote *remote)