Seriously broken "git pack-refs"

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

 



Do *NOT* try this on a repository you care about:

	git pack-refs --all --prune
	git pack-refs

because while the first "pack-refs" does the right thing, the second 
pack-refs will totally screw you over.

Why? 

The default for "git pack-refs" is to pack just tags. Which is a HORRIBLE 
MISTAKE. Becuase it means that if you actually had any packed non-tags, 
they now get removed entirely.

I'd call whoever made that decision a complete crack-addict and total 
idiot, but it might be me, so I'll just tread carefully and call the 
choice "interesting".

This should fix it.

		Linus
----
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 6de7128..3de9b3e 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -37,7 +37,9 @@ static int handle_one_ref(const char *path, const unsigned char *sha1,
 	if ((flags & REF_ISSYMREF))
 		return 0;
 	is_tag_ref = !strncmp(path, "refs/tags/", 10);
-	if (!cb->all && !is_tag_ref)
+
+	/* ALWAYS pack refs that were already packed or are tags */
+	if (!cb->all && !is_tag_ref && !(flags & REF_ISPACKED))
 		return 0;
 
 	fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
-
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]