summaryrefslogtreecommitdiff
path: root/t/t6500-gc.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-xt/t6500-gc.sh37
1 files changed, 27 insertions, 10 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 0a69a67..60d961b 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -10,7 +10,24 @@ 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
+ git config gc.bigPackThreshold 2g &&
+
+ # These are simply values which, when hashed as a blob with a newline,
+ # produce a hash where the first byte is 0x17 in their respective
+ # algorithms.
+ test_oid_cache <<-EOF
+ obj1 sha1:263
+ obj1 sha256:34
+
+ obj2 sha1:410
+ obj2 sha256:174
+
+ obj3 sha1:523
+ obj3 sha256:313
+
+ obj4 sha1:790
+ obj4 sha256:481
+ EOF
'
test_expect_success 'gc empty repository' '
@@ -61,7 +78,7 @@ test_expect_success 'gc --keep-largest-pack' '
git gc &&
( cd .git/objects/pack && ls *.pack ) >pack-list &&
test_line_count = 1 pack-list &&
- BASE_PACK=.git/objects/pack/pack-*.pack &&
+ cp pack-list base-pack-list &&
test_commit four &&
git repack -d &&
test_commit five &&
@@ -73,7 +90,7 @@ test_expect_success 'gc --keep-largest-pack' '
test_line_count = 2 pack-list &&
awk "/^P /{print \$2}" <.git/objects/info/packs >pack-info &&
test_line_count = 2 pack-info &&
- test_path_is_file $BASE_PACK &&
+ test_path_is_file .git/objects/pack/$(cat base-pack-list) &&
git fsck
)
'
@@ -85,21 +102,21 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
# We need to create two object whose sha1s start with 17
# since this is what git gc counts. As it happens, these
# two blobs will do so.
- test_commit 263 &&
- test_commit 410 &&
+ test_commit "$(test_oid obj1)" &&
+ test_commit "$(test_oid obj2)" &&
# Our first gc will create a pack; our second will create a second pack
git gc --auto &&
- ls .git/objects/pack | sort >existing_packs &&
- test_commit 523 &&
- test_commit 790 &&
+ ls .git/objects/pack/pack-*.pack | sort >existing_packs &&
+ test_commit "$(test_oid obj3)" &&
+ test_commit "$(test_oid obj4)" &&
git gc --auto 2>err &&
test_i18ngrep ! "^warning:" err &&
- ls .git/objects/pack/ | sort >post_packs &&
+ ls .git/objects/pack/pack-*.pack | sort >post_packs &&
comm -1 -3 existing_packs post_packs >new &&
comm -2 -3 existing_packs post_packs >del &&
test_line_count = 0 del && # No packs are deleted
- test_line_count = 2 new # There is one new pack and its .idx
+ test_line_count = 1 new # There is one new pack
'
test_expect_success 'gc --no-quiet' '