@matheusbsbs / matheus-bagliano / commits / efd8f793e4
Fork 0

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>

Daniel Barkalow committed Jun 15, 2007 at 10:22 UTC efd8f793e472069459c30e5d21bb2d203436c72a
1 file changed +3 -2
remote.c
+3 -2
@@ -536,10 +536,11 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
536 }
537
538 if (pat) {
539 - dst_name = xmalloc(strlen(pat->dst) +
539 + const char *dst_side = pat->dst ? pat->dst : pat->src;
540 + dst_name = xmalloc(strlen(dst_side) +
541 strlen(src->name) -
542 strlen(pat->src) + 2);
542 - strcpy(dst_name, pat->dst);
543 + strcpy(dst_name, dst_side);
544 strcat(dst_name, src->name + strlen(pat->src));
545 } else
546 dst_name = xstrdup(src->name);