All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] git-repack: shortcut in case of just one pack, and no loose objects
@ 2007-02-25  0:49 Johannes Schindelin
  0 siblings, 0 replies; only message in thread
From: Johannes Schindelin @ 2007-02-25  0:49 UTC (permalink / raw)
  To: git, junkio


When there is at most one pack, and there are no loose objects,
the result should be one pack _and_ reuse of deltas is allowed,
there is no need to repack, really.

The code does not check for *.keep files; they are either sign of
an ongoing repack, or of packs which do not matter for repacking
purposes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I _think_ this is correct, but I might have missed something 
	obvious...

 git-repack.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/git-repack.sh b/git-repack.sh
index ddfa8b4..15094b3 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -25,6 +25,16 @@ do
 	shift
 done
 
+if test "z$all_into_one" = zt -a "z$no_reuse_delta" = z; then
+	# check if no loose objects are around, and only up to one pack
+	objdirs="$(ls "$GIT_DIR"/objects/?? 2>/dev/null)"
+	packs="$(cd "$GIT_DIR/objects/pack/"; ls *.pack 2>/dev/null)"
+	case "$objdirs,$packs" in
+	*.pack*.pack*) ;;
+	,*) echo "No need to repack" >&2; exit 0
+	esac
+fi
+
 # Later we will default repack.UseDeltaBaseOffset to true
 default_dbo=false
 
-- 
1.5.0.1.2390.g7757

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-25  0:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-25  0:49 [RFC/PATCH] git-repack: shortcut in case of just one pack, and no loose objects Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.