From: Junio C Hamano Date: Tue, 20 Jun 2023 22:53:12 +0000 (-0700) Subject: Merge branch 'jc/test-modernization' X-Git-Tag: v2.42.0-rc0~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=208a28ec08bc472cdc54fcc2bbdb0179f626ab3d;p=thirdparty%2Fgit.git Merge branch 'jc/test-modernization' * jc/test-modernization: t7101-reset-empty-subdirs: modernize test format t6050-replace: modernize test format t5306-pack-nobase: modernize test format t5303-pack-corruption-resilience: modernize test format t5301-sliding-window: modernize test format t5300-pack-object: modernize test format t4206-log-follow-harder-copies: modernize test format t4202-log: modernize test format t4004-diff-rename-symlink: modernize test format t4003-diff-rename-1: modernize test format t4002-diff-basic: modernize test format t3903-stash: modernize test format t3700-add: modernize test format t3500-cherry: modernize test format t1006-cat-file: modernize test format t1002-read-tree-m-u-2way: modernize test format t1001-read-tree-m-2way: modernize test format t3210-pack-refs: modernize test format t0030-stripspace: modernize test format t0000-basic: modernize test format --- 208a28ec08bc472cdc54fcc2bbdb0179f626ab3d diff --cc t/t3210-pack-refs.sh index 9f399d2f75,5ec89931bb..7326adb70f --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@@ -67,90 -67,53 +67,90 @@@ test_expect_success 'see if git pack-re ' test_expect_success 'see if git pack-refs --prune removes empty dirs' ' - git branch r/s/t && - git pack-refs --all --prune && - ! test -e .git/refs/heads/r + git branch r/s/t && + git pack-refs --all --prune && + ! test -e .git/refs/heads/r ' - test_expect_success \ - 'git branch g should work when git branch g/h has been deleted' \ - 'git branch g/h && - git pack-refs --all --prune && - git branch -d g/h && - git branch g && - git pack-refs --all && - git branch -d g' + test_expect_success 'git branch g should work when git branch g/h has been deleted' ' + git branch g/h && + git pack-refs --all --prune && + git branch -d g/h && + git branch g && + git pack-refs --all && + git branch -d g + ' test_expect_success 'git branch i/j/k should barf if branch i exists' ' - git branch i && - git pack-refs --all --prune && - test_must_fail git branch i/j/k - ' - - test_expect_success \ - 'test git branch k after branch k/l/m and k/lm have been deleted' \ - 'git branch k/l && - git branch k/lm && - git branch -d k/l && - git branch k/l/m && - git branch -d k/l/m && - git branch -d k/lm && - git branch k' - - test_expect_success \ - 'test git branch n after some branch deletion and pruning' \ - 'git branch n/o && - git branch n/op && - git branch -d n/o && - git branch n/o/p && - git branch -d n/op && - git pack-refs --all --prune && - git branch -d n/o/p && - git branch n' + git branch i && + git pack-refs --all --prune && + test_must_fail git branch i/j/k + ' + + test_expect_success 'test git branch k after branch k/l/m and k/lm have been deleted' ' + git branch k/l && + git branch k/lm && + git branch -d k/l && + git branch k/l/m && + git branch -d k/l/m && + git branch -d k/lm && + git branch k + ' + + test_expect_success 'test git branch n after some branch deletion and pruning' ' + git branch n/o && + git branch n/op && + git branch -d n/o && + git branch n/o/p && + git branch -d n/op && + git pack-refs --all --prune && + git branch -d n/o/p && + git branch n + ' +test_expect_success 'test excluded refs are not packed' ' + git branch dont_pack1 && + git branch dont_pack2 && + git branch pack_this && + git pack-refs --all --exclude "refs/heads/dont_pack*" && + test -f .git/refs/heads/dont_pack1 && + test -f .git/refs/heads/dont_pack2 && + ! test -f .git/refs/heads/pack_this' + +test_expect_success 'test --no-exclude refs clears excluded refs' ' + git branch dont_pack3 && + git branch dont_pack4 && + git pack-refs --all --exclude "refs/heads/dont_pack*" --no-exclude && + ! test -f .git/refs/heads/dont_pack3 && + ! test -f .git/refs/heads/dont_pack4' + +test_expect_success 'test only included refs are packed' ' + git branch pack_this1 && + git branch pack_this2 && + git tag dont_pack5 && + git pack-refs --include "refs/heads/pack_this*" && + test -f .git/refs/tags/dont_pack5 && + ! test -f .git/refs/heads/pack_this1 && + ! test -f .git/refs/heads/pack_this2' + +test_expect_success 'test --no-include refs clears included refs' ' + git branch pack1 && + git branch pack2 && + git pack-refs --include "refs/heads/pack*" --no-include && + test -f .git/refs/heads/pack1 && + test -f .git/refs/heads/pack2' + +test_expect_success 'test --exclude takes precedence over --include' ' + git branch dont_pack5 && + git pack-refs --include "refs/heads/pack*" --exclude "refs/heads/pack*" && + test -f .git/refs/heads/dont_pack5' + - test_expect_success \ - 'see if up-to-date packed refs are preserved' \ - 'git branch q && - git pack-refs --all --prune && - git update-ref refs/heads/q refs/heads/q && - ! test -f .git/refs/heads/q' + test_expect_success 'see if up-to-date packed refs are preserved' ' + git branch q && + git pack-refs --all --prune && + git update-ref refs/heads/q refs/heads/q && + ! test -f .git/refs/heads/q + ' test_expect_success 'pack, prune and repack' ' git tag foo &&