git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Make git-repack use git-pack-intersect

From
Lukas Sandström <lukass@etek.chalmers.se>
Date
Nov 9, 2005, 01:25 UTC
Message-ID
<4371501C.6000204@etek.chalmers.se>
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
Previous: Lukas SandströmNext: Petr Baudis
Message 5 of 10 in “Add git-pack-intersect”
  1. 0/4 Add git-pack-intersectLukas Sandström, Nov 9, 2005
  2. 1/4 Add git-pack-intersectLukas Sandström, Nov 9, 2005
  3. 2/4 Add documentation for git-pack-intersectLukas Sandström, Nov 9, 2005
  4. 3/4 Add git-pack-intersect to .gitignoreLukas Sandström, Nov 9, 2005
  5. 4/4 Make git-repack use git-pack-intersectLukas Sandström, Nov 9, 2005
  6. Petr BaudisNov 9, 2005
  7. Andreas EricssonNov 9, 2005
  8. Lukas SandströmNov 9, 2005
  9. Junio C HamanoNov 10, 2005
  10. Rename git-pack-intersect to git-pack-redundantLukas Sandström, Nov 9, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.