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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---

 * 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;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux