Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-04-15 18:36:17 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-16 07:52:29 +0300
commit9806f5a7bf3d02247c2c500ef74f56213cd7b07a (patch)
treed81f3de59393e27d084d010e68c9f6f1b10fefa3 /t/t6500-gc.sh
parent8fc67762471c60ee644e6e100a3a85cf5a8631a0 (diff)
gc --auto: exclude base pack if not enough mem to "repack -ad"
pack-objects could be a big memory hog especially on large repos, everybody knows that. The suggestion to stick a .keep file on the giant base pack to avoid this problem is also known for a long time. Recent patches add an option to do just this, but it has to be either configured or activated manually. This patch lets `git gc --auto` activate this mode automatically when it thinks `repack -ad` will use a lot of memory and start affecting the system due to swapping or flushing OS cache. gc --auto decides to do this based on an estimation of pack-objects memory usage, which is quite accurate at least for the heap part, and whether that fits in half of system memory (the assumption here is for desktop environment where there are many other applications running). This mechanism only kicks in if gc.bigBasePackThreshold is not configured. If it is, it is assumed that the user already knows what they want. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-xt/t6500-gc.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index c42f60bc5b..818435f04e 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -5,6 +5,13 @@ test_description='basic git gc tests
. ./test-lib.sh
+test_expect_success 'setup' '
+ # do not let the amount of physical memory affects gc
+ # behavior, make sure we always pack everything to one pack by
+ # default
+ git config gc.bigPackThreshold 2g
+'
+
test_expect_success 'gc empty repository' '
git gc
'