From 5c47e1c7c56c60360646367e4067ed344a833b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kr=C3=BCger?= Date: Mon, 27 Sep 2010 14:19:36 +0200 Subject: [PATCH 1/2] repack: add -F flag to let user choose between --no-reuse-delta/object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 479b56ba ('make "repack -f" imply "pack-objects --no-reuse-object"'), git repack -f was changed to include recompressing all objects on the zlib level on the assumption that if the user wants to spend that much time already, some more time won't hurt (and recompressing is useful if the user changed the zlib compression level). However, "some more time" can be quite long with very big repositories, so some users are going to appreciate being able to choose. If we are going to give them the choice, --no-reuse-object will probably be interesting a lot less frequently than --no-reuse-delta. Hence, this reverts -f to the old behaviour (--no-reuse-delta) and adds a new -F option that replaces the current -f. Measurements taken using this patch on a current clone of git.git indicate a 17% decrease in time being made available to users: git repack -Adf 34.84s user 0.56s system 145% cpu 24.388 total git repack -AdF 38.79s user 0.56s system 133% cpu 29.394 total Signed-off-by: Jan Krüger Acked-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- Documentation/git-repack.txt | 6 +++++- git-repack.sh | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt index 8c67d1724f..9566727f7a 100644 --- a/Documentation/git-repack.txt +++ b/Documentation/git-repack.txt @@ -8,7 +8,7 @@ git-repack - Pack unpacked objects in a repository SYNOPSIS -------- -'git repack' [-a] [-A] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N] +'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [--window=N] [--depth=N] DESCRIPTION ----------- @@ -62,6 +62,10 @@ other objects in that pack they already have locally. linkgit:git-pack-objects[1]. -f:: + Pass the `--no-reuse-delta` option to `git-pack-objects`, see + linkgit:git-pack-objects[1]. + +-F:: Pass the `--no-reuse-object` option to `git-pack-objects`, see linkgit:git-pack-objects[1]. diff --git a/git-repack.sh b/git-repack.sh index 1eb3bca352..769baaf7e1 100755 --- a/git-repack.sh +++ b/git-repack.sh @@ -10,7 +10,8 @@ git repack [options] a pack everything in a single pack A same as -a, and turn unreachable objects loose d remove redundant packs, and run git-prune-packed -f pass --no-reuse-object to git-pack-objects +f pass --no-reuse-delta to git-pack-objects +F pass --no-reuse-object to git-pack-objects n do not run git-update-server-info q,quiet be quiet l pass --local to git-pack-objects @@ -34,7 +35,8 @@ do unpack_unreachable=--unpack-unreachable ;; -d) remove_redundant=t ;; -q) GIT_QUIET=t ;; - -f) no_reuse=--no-reuse-object ;; + -f) no_reuse=--no-reuse-delta ;; + -F) no_reuse=--no-reuse-object ;; -l) local=--local ;; --max-pack-size|--window|--window-memory|--depth) extra="$extra $1=$2"; shift ;; From 89d71f7564cb3945b2775092284a4de807f577e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kr=C3=BCger?= Date: Mon, 27 Sep 2010 14:21:58 +0200 Subject: [PATCH 2/2] Documentation: pack.compression: explain how to recompress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a small remark about how to recompress all existing objects after changing the compression level for pack files. Signed-off-by: Jan Krüger Acked-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- Documentation/config.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index d82c0da2cf..ad81df3370 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1466,6 +1466,10 @@ pack.compression:: not set, defaults to -1, the zlib default, which is "a default compromise between speed and compression (currently equivalent to level 6)." ++ +Note that changing the compression level will not automatically recompress +all existing objects. You can force recompression by passing the -F option +to linkgit:git-repack[1]. pack.deltaCacheSize:: The maximum memory in bytes used for caching deltas in