aboutsummaryrefslogtreecommitdiffstats
path: root/t/t0601-reffiles-pack-refs.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-04 10:53:03 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-04 08:03:24 -0700
commitbd51dca36e0afcff36789bd6eb0135ebe66fcd81 (patch)
tree0dc4ff405b22e263b4043d1cd9b423e40623a449 /t/t0601-reffiles-pack-refs.sh
parentwrapper: introduce `log2u()` (diff)
downloadgit-bd51dca36e0afcff36789bd6eb0135ebe66fcd81.tar.gz
git-bd51dca36e0afcff36789bd6eb0135ebe66fcd81.zip
t0601: merge tests for auto-packing of refs
We have two tests in t0601 which exercise the same underlying logic, once via `git pack-refs --auto` and once via `git maintenance run --auto`. Merge these two tests into one such that it becomes easier to extend test coverage for both commands at the same time. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-xt/t0601-reffiles-pack-refs.sh36
1 files changed, 20 insertions, 16 deletions
diff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh
index 60a544b8ee..ed9652bb82 100755
--- a/t/t0601-reffiles-pack-refs.sh
+++ b/t/t0601-reffiles-pack-refs.sh
@@ -161,13 +161,6 @@ 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 &&
@@ -367,14 +360,25 @@ 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
-'
+for command in "git pack-refs --all --auto" "git maintenance run --task=pack-refs --auto"
+do
+ test_expect_success "$command unconditionally packs loose refs" '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ git config set maintenance.auto false &&
+ test_commit initial &&
+
+ git update-ref refs/heads/something HEAD &&
+ test_path_is_file .git/refs/heads/something &&
+ git rev-parse refs/heads/something >expect &&
+ $command &&
+ test_path_is_missing .git/refs/heads/something &&
+ git rev-parse refs/heads/something >actual &&
+ test_cmp expect actual
+ )
+ '
+done
test_done