git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: joakim.tjernlund@transmode.se, Daniel Barkalow <barkalow@iabervon.org>
Subject: [PATCH/RFC] Allow "git remote --mirror" to mirror stashes
Date: Thu, 27 Mar 2008 23:16:58 -0700	[thread overview]
Message-ID: <7vbq4z4bl1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1205604534.7589.20.camel@gentoo-jocke.transmode.se

When you have "remote.$there.fetch = refs/*:refs/*" and the remote has a
ref directly under refs/ (e.g. "stash"), "git fetch" still errored out
even with fixes in -rc1.

This should hopefully fix it.

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

 * Rather than failing, it would be better to allow "git fetch" to succeed
   by doing this, but on the other hand, stash is purely a local matter,
   so it might make more sense to avoid exposing it from the uploader.

 builtin-fetch-pack.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 65350ca..472bad5 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -363,10 +363,17 @@ static void filter_refs(struct ref **refs, int nr_match, char **match)
 		return_refs = NULL;
 
 	for (ref = *refs; ref; ref = next) {
+		int trash = 0;
+
 		next = ref->next;
-		if (!memcmp(ref->name, "refs/", 5) &&
-		    check_ref_format(ref->name + 5))
-			; /* trash */
+		if (!memcmp(ref->name, "refs/", 5)) {
+			trash = check_ref_format(ref->name + 5);
+			if (trash == CHECK_REF_FORMAT_ONELEVEL)
+				trash = 0;
+		}
+
+		if (trash)
+			; /* this is trash */
 		else if (args.fetch_all &&
 			 (!args.depth || prefixcmp(ref->name, "refs/tags/") )) {
 			*newtail = ref;

  parent reply	other threads:[~2008-03-28  6:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-14 13:05 git remote --mirror bug? Joakim Tjernlund
2008-03-15 18:08 ` Joakim Tjernlund
2008-03-16 10:21   ` Re* " Junio C Hamano
2008-03-16 17:21     ` remote/clone bug: Stale tracking branch HEAD Teemu Likonen
2008-03-16 22:24       ` On fetch refspecs and wildcards Junio C Hamano
2008-03-16 22:33         ` Junio C Hamano
2008-03-16 23:03         ` Daniel Barkalow
2008-03-17  0:14           ` Junio C Hamano
2008-03-17  2:14             ` Daniel Barkalow
2008-03-18 14:04     ` Re* git remote --mirror bug? Johannes Schindelin
2008-03-18 19:02       ` Junio C Hamano
2008-03-19  0:35         ` Johannes Schindelin
2008-03-28  6:16   ` Junio C Hamano [this message]
2008-03-28 15:45     ` [PATCH/RFC] Allow "git remote --mirror" to mirror stashes Daniel Barkalow
2008-03-31  0:19       ` Junio C Hamano
2008-03-31  3:03         ` Daniel Barkalow

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=7vbq4z4bl1.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=joakim.tjernlund@transmode.se \
    /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;
as well as URLs for NNTP newsgroup(s).