summaryrefslogtreecommitdiff
path: root/builtin-pack-refs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-01-26 00:51:21 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-26 03:16:07 (GMT)
commit1b555932cdb7f75239623573cd2ff25fa98ab4e4 (patch)
tree3cd342e77ecef95266e8bba684b5931ffbe9cd29 /builtin-pack-refs.c
parent535514f1f3cd32dfe2cb4c70e97b41ea868d1134 (diff)
downloadgit-1b555932cdb7f75239623573cd2ff25fa98ab4e4.zip
git-1b555932cdb7f75239623573cd2ff25fa98ab4e4.tar.gz
git-1b555932cdb7f75239623573cd2ff25fa98ab4e4.tar.bz2
Fix seriously broken "git pack-refs"
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. This is because the second one tries to pack only tags; we should also pack what are already packed -- otherwise we would lose them. [jc: with an additional test] Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-refs.c')
-rw-r--r--builtin-pack-refs.c4
1 files changed, 3 insertions, 1 deletions
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);