]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t0601-reffiles-pack-refs.sh
Merge branch 'ps/ci-test-with-jgit'
[thirdparty/git.git] / t / t0601-reffiles-pack-refs.sh
index 157f79fe520de25e603824dce7872c173cdae3df..60a544b8ee89833906789ac9525bb852bd3cc971 100755 (executable)
@@ -29,11 +29,16 @@ test_expect_success 'prepare a trivial repository' '
        HEAD=$(git rev-parse --verify HEAD)
 '
 
-test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
-       N=`find .git/refs -type f | wc -l` &&
+test_expect_success 'pack-refs --prune --all' '
+       test_path_is_missing .git/packed-refs &&
+       git pack-refs --no-prune --all &&
+       test_path_is_file .git/packed-refs &&
+       N=$(find .git/refs -type f | wc -l) &&
        test "$N" != 0 &&
-       test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&
-       N=`find .git/refs -type f` &&
+
+       git pack-refs --prune --all &&
+       test_path_is_file .git/packed-refs &&
+       N=$(find .git/refs -type f) &&
        test -z "$N"
 '
 
@@ -156,6 +161,13 @@ test_expect_success 'test --exclude takes precedence over --include' '
        git pack-refs --include "refs/heads/pack*" --exclude "refs/heads/pack*" &&
        test -f .git/refs/heads/dont_pack5'
 
+test_expect_success '--auto packs and prunes refs as usual' '
+       git branch auto &&
+       test_path_is_file .git/refs/heads/auto &&
+       git pack-refs --auto --all &&
+       test_path_is_missing .git/refs/heads/auto
+'
+
 test_expect_success 'see if up-to-date packed refs are preserved' '
        git branch q &&
        git pack-refs --all --prune &&
@@ -355,4 +367,14 @@ test_expect_success 'pack-refs does not drop broken refs during deletion' '
        test_cmp expect actual
 '
 
+test_expect_success 'maintenance --auto unconditionally packs loose refs' '
+       git update-ref refs/heads/something HEAD &&
+       test_path_is_file .git/refs/heads/something &&
+       git rev-parse refs/heads/something >expect &&
+       git maintenance run --task=pack-refs --auto &&
+       test_path_is_missing .git/refs/heads/something &&
+       git rev-parse refs/heads/something >actual &&
+       test_cmp expect actual
+'
+
 test_done