t7004: do not chdir around in the main process

Move down to no-contains subdirectory inside a subshell, just like the previous step that created and used it does. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 4, 2025 at 07:28 UTC 61ac8ba0f034b61d7353a799fecae9fe45137a72
1 file changed +20 -18
t/t7004-tag.sh
+20 -18
@@ -2293,24 +2293,26 @@ test_expect_success '--contains combined with --no-contains' '
2293 # don't recurse down to tags for trees or blobs pointed to by *those*
2294 # commits.
2295 test_expect_success 'Does --[no-]contains stop at commits? Yes!' '
2296 - cd no-contains &&
2297 - blob=$(git rev-parse v0.3:v0.3.t) &&
2298 - tree=$(git rev-parse v0.3^{tree}) &&
2299 - git tag tag-blob $blob &&
2300 - git tag tag-tree $tree &&
2301 - git tag --contains v0.3 >actual &&
2302 - cat >expected <<-\EOF &&
2303 - v0.3
2304 - v0.4
2305 - v0.5
2306 - EOF
2307 - test_cmp expected actual &&
2308 - git tag --no-contains v0.3 >actual &&
2309 - cat >expected <<-\EOF &&
2310 - v0.1
2311 - v0.2
2312 - EOF
2313 - test_cmp expected actual
2296 + (
2297 + cd no-contains &&
2298 + blob=$(git rev-parse v0.3:v0.3.t) &&
2299 + tree=$(git rev-parse v0.3^{tree}) &&
2300 + git tag tag-blob $blob &&
2301 + git tag tag-tree $tree &&
2302 + git tag --contains v0.3 >actual &&
2303 + cat >expected <<-\EOF &&
2304 + v0.3
2305 + v0.4
2306 + v0.5
2307 + EOF
2308 + test_cmp expected actual &&
2309 + git tag --no-contains v0.3 >actual &&
2310 + cat >expected <<-\EOF &&
2311 + v0.1
2312 + v0.2
2313 + EOF
2314 + test_cmp expected actual
2315 + )
2316 '
2317
2318 test_expect_success 'If tag is created then tag message file is unlinked' '