"git-push $URL" without refspecs pushes only matching branches
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 Jul 2007 02:00:08 +0000 (19:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jul 2007 03:57:45 +0000 (20:57 -0700)
When "git push" is run without any refspec (neither on the
command line nor in the config), we used to push "matching refs"
in the sense that anything under refs/ hierarchy that exist on
both ends were updated.  This used to be a sane default for
publishing your repository to another back when we did not have
refs/remotes/ hierarchy, but it does not make much sense these
days.

This changes the semantics to push only "matching branches".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c

index 500ca4d968753485ac38d44e238e93ab86372c1c..cf98a44367cfad364871af4f1e191a9e7412562d 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -544,6 +544,13 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
                        if (!pat)
                                continue;
                }
+               else if (prefixcmp(src->name, "refs/heads/"))
+                       /*
+                        * "matching refs"; traditionally we pushed everything
+                        * including refs outside refs/heads/ hierarchy, but
+                        * that does not make much sense these days.
+                        */
+                       continue;
 
                if (pat) {
                        const char *dst_side = pat->dst ? pat->dst : pat->src;