Skip to content

Commit 5c47e1c

Browse files
jastgitster
authored andcommitted
repack: add -F flag to let user choose between --no-reuse-delta/object
In 479b56b ('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 <[email protected]> Acked-by: Nicolas Pitre <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9027fa9 commit 5c47e1c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Documentation/git-repack.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-repack - Pack unpacked objects in a repository
88

99
SYNOPSIS
1010
--------
11-
'git repack' [-a] [-A] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N]
11+
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [--window=N] [--depth=N]
1212

1313
DESCRIPTION
1414
-----------
@@ -62,6 +62,10 @@ other objects in that pack they already have locally.
6262
linkgit:git-pack-objects[1].
6363

6464
-f::
65+
Pass the `--no-reuse-delta` option to `git-pack-objects`, see
66+
linkgit:git-pack-objects[1].
67+
68+
-F::
6569
Pass the `--no-reuse-object` option to `git-pack-objects`, see
6670
linkgit:git-pack-objects[1].
6771

git-repack.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ git repack [options]
1010
a pack everything in a single pack
1111
A same as -a, and turn unreachable objects loose
1212
d remove redundant packs, and run git-prune-packed
13-
f pass --no-reuse-object to git-pack-objects
13+
f pass --no-reuse-delta to git-pack-objects
14+
F pass --no-reuse-object to git-pack-objects
1415
n do not run git-update-server-info
1516
q,quiet be quiet
1617
l pass --local to git-pack-objects
@@ -34,7 +35,8 @@ do
3435
unpack_unreachable=--unpack-unreachable ;;
3536
-d) remove_redundant=t ;;
3637
-q) GIT_QUIET=t ;;
37-
-f) no_reuse=--no-reuse-object ;;
38+
-f) no_reuse=--no-reuse-delta ;;
39+
-F) no_reuse=--no-reuse-object ;;
3840
-l) local=--local ;;
3941
--max-pack-size|--window|--window-memory|--depth)
4042
extra="$extra $1=$2"; shift ;;

0 commit comments

Comments
 (0)