Re: Remove unneeded packs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: lukass
Date: Sunday, November 13, 2005 - 3:58 am

Junio C Hamano wrote:

It depends on how expensive git-fsck-objects --full --unreacahble is versus
a full repack.

Howerver, if I read the source correctly git-fsck-objects doesn't currently test 
the reachablility of packed objects. This would have to change, and I'm not certain
of how to do that properly.

Note that the following patch is reqired if git-repack -a -d is to work as expected.
(Remove all packs except the new one)

Btw, I'm sending this patch in utf8, let's see if it works...

----
Subject: [PATCH] Make sure all old packfiles are removed when doing a full repack

This is nessecary because unrachable objects in packfiles makes git-pack-redundant
flag them as non-redundant.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>

---

 git-repack.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

applies-to: 9a0f0c748316751fbf593a21f2b16bcdd975095a
08df1f641bd3f98a607a8413d647667adc18a633
diff --git a/git-repack.sh b/git-repack.sh
index f347207..293bb50 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -32,6 +32,8 @@ case ",$all_into_one," in
 	rev_list=
 	rev_parse='--all'
 	pack_objects=
+	existing=`cd "$PACKDIR" && \
+	    find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
 	;;
 esac
 if [ "$local" ]; then
@@ -60,7 +62,19 @@ mv .tmp-pack-$name.pack "$PACKDIR/pack-$
 mv .tmp-pack-$name.idx  "$PACKDIR/pack-$name.idx" ||
 exit
 
-if test "$remove_redandant" = t
+if test "$all_into_one" = t
+then
+	sync
+	( cd "$PACKDIR" &&
+		for e in $existing
+		do
+		case "$e" in
+		./pack-$name.pack | ./pack-$name.idx) ;;
+		*)	rm -f $e ;;
+		esac
+		done
+	)
+else if test "$remove_redandant" = t
 then
 	sync
 	redundant=$(git-pack-redundant --all)
---
0.99.9.GIT
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Remove unneeded packs, Marcel Holtmann, (Sat Nov 12, 6:04 am)
Re: Remove unneeded packs, Andreas Ericsson, (Sat Nov 12, 6:13 am)
Re: Remove unneeded packs, Marcel Holtmann, (Sat Nov 12, 6:30 am)
Re: Remove unneeded packs, Craig Schlenter, (Sat Nov 12, 6:40 am)
Balanced packing strategy, Petr Baudis, (Sat Nov 12, 6:59 am)
Re: Balanced packing strategy, Craig Schlenter, (Sat Nov 12, 8:14 am)
Re: Remove unneeded packs, lukass, (Sat Nov 12, 3:02 pm)
Re: Remove unneeded packs, Marcel Holtmann, (Sat Nov 12, 3:13 pm)
Re: Balanced packing strategy, Junio C Hamano, (Sat Nov 12, 7:34 pm)
Re: Remove unneeded packs, Junio C Hamano, (Sat Nov 12, 7:38 pm)
Re: Remove unneeded packs, lukass, (Sun Nov 13, 3:58 am)
Re: Balanced packing strategy, Petr Baudis, (Sun Nov 13, 4:00 am)
Re: Remove unneeded packs, Sergey Vlasov, (Sun Nov 13, 5:00 am)
Re: Remove unneeded packs, lukass, (Sun Nov 13, 5:07 am)
Re: Remove unneeded packs, Sergey Vlasov, (Sun Nov 13, 5:20 am)
Re: Remove unneeded packs, lukass, (Sun Nov 13, 5:31 am)
Re: Balanced packing strategy, Josef Weidendorfer, (Sun Nov 13, 1:06 pm)
Re: Balanced packing strategy, Junio C Hamano, (Sun Nov 13, 4:13 pm)