{"thread":{"id":"6943","subject":"[RFC/PATCH] git-repack: shortcut in case of just one pack, and no loose objects","startedAt":"2007-02-25T00:49:11Z","lastAt":"2007-02-25T00:49:11Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"35407","messageId":"Pine.LNX.4.63.0702250144530.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6943","inReplyTo":null,"subject":"[RFC/PATCH] git-repack: shortcut in case of just one pack, and no loose objects","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-25T00:49:11Z","receivedAt":"2007-02-25T00:49:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen there is at most one pack, and there are no loose objects,\nthe result should be one pack _and_ reuse of deltas is allowed,\nthere is no need to repack, really.\n\nThe code does not check for *.keep files; they are either sign of\nan ongoing repack, or of packs which do not matter for repacking\npurposes.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tI _think_ this is correct, but I might have missed something \n\tobvious...\n\n git-repack.sh |   10 ++++++++++\n 1 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/git-repack.sh b/git-repack.sh\nindex ddfa8b4..15094b3 100755\n--- a/git-repack.sh\n+++ b/git-repack.sh\n@@ -25,6 +25,16 @@ do\n \tshift\n done\n \n+if test \"z$all_into_one\" = zt -a \"z$no_reuse_delta\" = z; then\n+\t# check if no loose objects are around, and only up to one pack\n+\tobjdirs=\"$(ls \"$GIT_DIR\"/objects/?? 2>/dev/null)\"\n+\tpacks=\"$(cd \"$GIT_DIR/objects/pack/\"; ls *.pack 2>/dev/null)\"\n+\tcase \"$objdirs,$packs\" in\n+\t*.pack*.pack*) ;;\n+\t,*) echo \"No need to repack\" >&2; exit 0\n+\tesac\n+fi\n+\n # Later we will default repack.UseDeltaBaseOffset to true\n default_dbo=false\n \n-- \n1.5.0.1.2390.g7757\n"}]}