From: Bryan Drewery <bryan@shatow.net>
To: git@vger.kernel.org
Cc: Bryan Drewery <bryan@shatow.net>
Subject: [PATCH] Fix git-push --mirror also mirroring refs/remotes/
Date: Sun, 10 May 2009 14:35:36 -0500 [thread overview]
Message-ID: <1241984136-2578-1-git-send-email-bryan@shatow.net> (raw)
git-push --mirror was incorrectly mirroring refs/remotes/
previously. This patch fixes it to follow the documentation
which is to mirror only refs/heads/ and refs/tags/.
Signed-off-by: Bryan Drewery <bryan@shatow.net>
---
remote.c | 4 +++-
t/t5517-push-mirror.sh | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/remote.c b/remote.c
index d66e2f3..70cfab8 100644
--- a/remote.c
+++ b/remote.c
@@ -1123,8 +1123,10 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
* "matching refs"; traditionally we pushed everything
* including refs outside refs/heads/ hierarchy, but
* that does not make much sense these days.
+ * Push only refs/heads/ and refs/tags/ when mirroring
+ * otherwise only matching refs/heads/
*/
- if (!send_mirror && prefixcmp(src->name, "refs/heads/"))
+ if ((!send_mirror || prefixcmp(src->name, "refs/tags/")) && prefixcmp(src->name, "refs/heads/"))
continue;
dst_name = xstrdup(src->name);
diff --git a/t/t5517-push-mirror.sh b/t/t5517-push-mirror.sh
index ea49ded..3fc7dc2 100755
--- a/t/t5517-push-mirror.sh
+++ b/t/t5517-push-mirror.sh
@@ -264,4 +264,25 @@ test_expect_success 'remote.foo.mirror=no has no effect' '
'
+# REMOTES test
+test_expect_success 'push mirror does not push remotes' '
+
+ mk_repo_pair &&
+ (
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ git push --mirror up &&
+ git remote update &&
+ git push --mirror up
+ ) &&
+ master_master=$(cd master && git show-ref -s --verify refs/heads/master) &&
+ mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&
+ test "$master_master" = "$mirror_master" &&
+ (
+ cd mirror &&
+ invert git show-ref -s --verify refs/remotes/up/master
+ )
+'
+
+
test_done
--
1.6.2.5
next reply other threads:[~2009-05-10 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-10 19:35 Bryan Drewery [this message]
2009-05-10 20:25 ` [PATCH] Fix git-push --mirror also mirroring refs/remotes/ Markus Heidelberg
2009-05-10 20:50 ` Bryan Drewery
2009-05-10 21:13 ` Markus Heidelberg
2009-05-10 21:31 ` Bryan Drewery
2009-05-10 21:56 ` Junio C Hamano
2009-05-10 22:15 ` Markus Heidelberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1241984136-2578-1-git-send-email-bryan@shatow.net \
--to=bryan@shatow.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox