git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lukas Sandström" <lukass@etek.chalmers.se>
To: git@vger.kernel.org
Cc: "Lukas Sandström" <lukass@etek.chalmers.se>, junkio@cox.net
Subject: [PATCH 4/4] Make git-repack use git-pack-intersect
Date: Wed, 09 Nov 2005 02:25:48 +0100	[thread overview]
Message-ID: <4371501C.6000204@etek.chalmers.se> (raw)
In-Reply-To: <43714EFB.5070705@etek.chalmers.se>

Make git-repack use git-pack-intersect.

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

---

 git-repack.sh |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

applies-to: 73e05dab832dd7320a5128fbf97e693f23ffb949
2cbd6ade19a768eca47f6f7313f6831226ee58b7
diff --git a/git-repack.sh b/git-repack.sh
index d341966..3f28300 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -32,10 +32,6 @@ case ",$all_into_one," in
 	rev_list=
 	rev_parse='--all'
 	pack_objects=
-	# This part is a stop-gap until we have proper pack redundancy
-	# checker.
-	existing=`cd "$PACKDIR" && \
-	    find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
 	;;
 esac
 if [ "$local" ]; then
@@ -46,6 +42,14 @@ name=$(git-rev-list --objects $rev_list 
 	exit 1
 if [ -z "$name" ]; then
 	echo Nothing new to pack.
+	if test "$remove_redandant" = t ; then
+		echo "Removing redundant packs."
+		sync
+		redundant=$(git-pack-intersect -a)
+		if test "$redundant" != "" ; then
+			echo $redundant | xargs rm
+		fi
+	fi
 	exit 0
 fi
 echo "Pack pack-$name created."
@@ -58,20 +62,10 @@ exit
 
 if test "$remove_redandant" = t
 then
-	# We know $existing are all redandant only when
-	# all-into-one is used.
-	if test "$all_into_one" != '' && test "$existing" != ''
-	then
-		sync
-		( cd "$PACKDIR" &&
-		  for e in $existing
-		  do
-			case "$e" in
-			./pack-$name.pack | ./pack-$name.idx) ;;
-			*)	rm -f $e ;;
-			esac
-		  done
-		)
+	sync
+	redundant=$(git-pack-intersect -a)
+	if test "$redundant" != "" ; then
+		echo $redundant | xargs rm
 	fi
 fi
 
---
0.99.9.GIT

  parent reply	other threads:[~2005-11-09  1:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09  1:20 [PATCH 0/4] Add git-pack-intersect Lukas Sandström
2005-11-09  1:22 ` [PATCH 1/4] " Lukas Sandström
2005-11-09  1:23 ` [PATCH 2/4] Add documentation for git-pack-intersect Lukas Sandström
2005-11-09  1:24 ` [PATCH 3/4] Add git-pack-intersect to .gitignore Lukas Sandström
2005-11-09  1:25 ` Lukas Sandström [this message]
2005-11-09 11:19 ` [PATCH 0/4] Add git-pack-intersect Petr Baudis
2005-11-09 11:58   ` Andreas Ericsson
2005-11-09 23:24     ` Lukas Sandström
2005-11-10  0:15       ` Junio C Hamano
2005-11-09 23:16   ` [PATCH] Rename git-pack-intersect to git-pack-redundant Lukas Sandström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4371501C.6000204@etek.chalmers.se \
    --to=lukass@etek.chalmers.se \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).