aboutsummaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-06-09 01:37:14 -0700
committerJunio C Hamano <gitster@pobox.com>2007-06-09 11:53:01 -0700
commit1ed10b886bc69c129c06772ee4310c00e001657f (patch)
treef19105cd3c933ad98f9143163b781393ffcb8fdf /remote.c
parent6125796f7d6e8b84431f92c13d7e79bd30f94f53 (diff)
downloadgit-1ed10b886bc69c129c06772ee4310c00e001657f.tar.gz
git-1ed10b886bc69c129c06772ee4310c00e001657f.tar.xz
remote.c: "git-push frotz" should update what matches at the source.
Earlier, when the local repository has a branch "frotz" and the remote repository has a tag "frotz" (but not branch "frotz"), "git-push frotz" mistakenly updated the tag at the remote side. This was because the partial refname matching code was applied independently on both source and destination side. With this fix, when a colon-less refspec is given to git-push, we first match it with the refs in the source repository, and update the matching ref in the destination repository. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/remote.c b/remote.c
index 120df36be..754d5130e 100644
--- a/remote.c
+++ b/remote.c
@@ -455,7 +455,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
errs = 1;
if (dst_value == NULL)
- dst_value = rs->src;
+ dst_value = matched_src->name;
switch (count_refspec_match(dst_value, dst, &matched_dst)) {
case 1:
@@ -463,11 +463,6 @@ static int match_explicit(struct ref *src, struct ref *dst,
case 0:
if (!memcmp(dst_value, "refs/", 5))
matched_dst = make_dst(dst_value, dst_tail);
- else if (!strcmp(rs->src, dst_value) && matched_src)
- /* pushing "master:master" when
- * remote does not have master yet.
- */
- matched_dst = make_dst(matched_src->name, dst_tail);
else
error("dst refspec %s does not match any "
"existing ref on the remote and does "