public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* Seriously broken "git pack-refs"
@ 2007-01-26  0:51 Linus Torvalds
  2007-01-26  3:22 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2007-01-26  0:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List


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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-26  6:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26  0:51 Seriously broken "git pack-refs" Linus Torvalds
2007-01-26  3:22 ` Junio C Hamano
2007-01-26  6:05   ` Linus Torvalds
2007-01-26  6:08     ` Junio C Hamano
2007-01-26  6:24       ` Linus Torvalds
2007-01-26  6:50         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox