git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC] Allow "git remote --mirror" to mirror stashes

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 28, 2008, 06:16 UTC
Message-ID
<7vbq4z4bl1.fsf@gitster.siamese.dyndns.org>
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;
Previous: Johannes SchindelinNext: Daniel Barkalow
Message 13 of 16 in “git remote --mirror bug?”
  1. Joakim TjernlundMar 14, 2008
  2. Joakim TjernlundMar 15, 2008
  3. Re* git remote --mirror bug?Junio C Hamano, Mar 16, 2008
  4. remote/clone bug: Stale tracking branch HEADTeemu Likonen, Mar 16, 2008
  5. On fetch refspecs and wildcardsJunio C Hamano, Mar 16, 2008
  6. Junio C HamanoMar 16, 2008
  7. Daniel BarkalowMar 16, 2008
  8. Junio C HamanoMar 17, 2008
  9. Daniel BarkalowMar 17, 2008
  10. Johannes SchindelinMar 18, 2008
  11. Junio C HamanoMar 18, 2008
  12. Johannes SchindelinMar 19, 2008
  13. Allow "git remote --mirror" to mirror stashesJunio C Hamano, Mar 28, 2008
  14. Daniel BarkalowMar 28, 2008
  15. Junio C HamanoMar 31, 2008
  16. Daniel BarkalowMar 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.