aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2007-06-15 10:22:37 -0400
committerJunio C Hamano <gitster@pobox.com>2007-06-16 01:20:26 -0700
commitefd8f793e472069459c30e5d21bb2d203436c72a (patch)
treee6c60b11875f3d72370d5f2faf73d19dc2491e2e
parent38570a47fcd9d7631c03673249f587697fa85677 (diff)
downloadgit-efd8f793e472069459c30e5d21bb2d203436c72a.tar.gz
git-efd8f793e472069459c30e5d21bb2d203436c72a.tar.xz
Fix pushing to a pattern with no dst
Refspecs with no colons are left with no dst value, because they are interepreted differently for fetch and push. For push, they mean to reuse the src side. Fix this for patterns. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--remote.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/remote.c b/remote.c
index ed62a62fa..54c9401a6 100644
--- a/remote.c
+++ b/remote.c
@@ -536,10 +536,11 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
}
if (pat) {
- dst_name = xmalloc(strlen(pat->dst) +
+ const char *dst_side = pat->dst ? pat->dst : pat->src;
+ dst_name = xmalloc(strlen(dst_side) +
strlen(src->name) -
strlen(pat->src) + 2);
- strcpy(dst_name, pat->dst);
+ strcpy(dst_name, dst_side);
strcat(dst_name, src->name + strlen(pat->src));
} else
dst_name = xstrdup(src->name);