Skip to content

Commit bd51dca

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d343068 commit bd51dca

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

t/t0601-reffiles-pack-refs.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,6 @@ test_expect_success 'test --exclude takes precedence over --include' '
161161
git pack-refs --include "refs/heads/pack*" --exclude "refs/heads/pack*" &&
162162
test -f .git/refs/heads/dont_pack5'
163163

164-
test_expect_success '--auto packs and prunes refs as usual' '
165-
git branch auto &&
166-
test_path_is_file .git/refs/heads/auto &&
167-
git pack-refs --auto --all &&
168-
test_path_is_missing .git/refs/heads/auto
169-
'
170-
171164
test_expect_success 'see if up-to-date packed refs are preserved' '
172165
git branch q &&
173166
git pack-refs --all --prune &&
@@ -367,14 +360,25 @@ test_expect_success 'pack-refs does not drop broken refs during deletion' '
367360
test_cmp expect actual
368361
'
369362

370-
test_expect_success 'maintenance --auto unconditionally packs loose refs' '
371-
git update-ref refs/heads/something HEAD &&
372-
test_path_is_file .git/refs/heads/something &&
373-
git rev-parse refs/heads/something >expect &&
374-
git maintenance run --task=pack-refs --auto &&
375-
test_path_is_missing .git/refs/heads/something &&
376-
git rev-parse refs/heads/something >actual &&
377-
test_cmp expect actual
378-
'
363+
for command in "git pack-refs --all --auto" "git maintenance run --task=pack-refs --auto"
364+
do
365+
test_expect_success "$command unconditionally packs loose refs" '
366+
test_when_finished "rm -rf repo" &&
367+
git init repo &&
368+
(
369+
cd repo &&
370+
git config set maintenance.auto false &&
371+
test_commit initial &&
372+
373+
git update-ref refs/heads/something HEAD &&
374+
test_path_is_file .git/refs/heads/something &&
375+
git rev-parse refs/heads/something >expect &&
376+
$command &&
377+
test_path_is_missing .git/refs/heads/something &&
378+
git rev-parse refs/heads/something >actual &&
379+
test_cmp expect actual
380+
)
381+
'
382+
done
379383

380384
test_done

0 commit comments

Comments
 (0)