3 test_description
='basic git gc tests
8 test_expect_success
'gc empty repository' '
12 test_expect_success
'gc does not leave behind pid file' '
14 test_path_is_missing .git/gc.pid
17 test_expect_success
'gc --gobbledegook' '
18 test_expect_code 129 git gc --nonsense 2>err &&
19 test_i18ngrep "[Uu]sage: git gc" err
22 test_expect_success
'gc -h with invalid configuration' '
27 echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
28 test_expect_code 129 git gc -h >usage 2>&1
30 test_i18ngrep "[Uu]sage" broken/usage
33 test_expect_success
'gc is not aborted due to a stale symref' '
37 test_commit initial &&
38 git clone . ../client &&
39 git branch -m develop &&
46 test_expect_success
'auto gc with too many loose objects does not attempt to create bitmaps' '
47 test_config gc.auto 3 &&
48 test_config gc.autodetach false &&
49 test_config pack.writebitmaps true &&
50 # We need to create two object whose sha1s start with 17
51 # since this is what git gc counts. As it happens, these
52 # two blobs will do so.
55 # Our first gc will create a pack; our second will create a second pack
57 ls .git/objects/pack | sort >existing_packs &&
61 git gc --auto 2>err &&
62 test_i18ngrep ! "^warning:" err &&
63 ls .git/objects/pack/ | sort >post_packs &&
64 comm -1 -3 existing_packs post_packs >new &&
65 comm -2 -3 existing_packs post_packs >del &&
66 test_line_count = 0 del && # No packs are deleted
67 test_line_count = 2 new # There is one new pack and its .idx