t3903: reduce dependencies on previous tests
Skipping previous tests to work through only failing tests with arguments like --run=4,122- causes some tests to fail because subdir doesn't exist yet (it is created by a previous test; typically "unstashing in a subdirectory"). Create it on demand for tests that need it, but don't fail (-p) if the directory already exists. Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
D. Ben Knoble committed
Sep 21, 2025 at 21:39 UTC
80bc042b4711b00dd35f24fd0c6ee450f41f3c2c
1 file changed
+3
t/t3903-stash.sh
+3
@@ -895,6 +895,7 @@ test_expect_success 'branch: should not drop the stash if the apply fails' '
895
896
test_expect_success 'apply: show same status as git status (relative to ./)' '
897
git stash clear &&
898
+ mkdir -p subdir &&
899
echo 1 >subdir/subfile1 &&
900
echo 2 >subdir/subfile2 &&
901
git add subdir/subfile1 &&
@@ -1327,6 +1328,7 @@ test_expect_success 'stash -k -- <pathspec> leaves unstaged files intact' '
1328
1329
test_expect_success 'stash -- <subdir> leaves untracked files in subdir intact' '
1330
git reset &&
1331
+ mkdir -p subdir &&
1332
>subdir/untracked &&
1333
>subdir/tracked1 &&
1334
>subdir/tracked2 &&
@@ -1343,6 +1345,7 @@ test_expect_success 'stash -- <subdir> leaves untracked files in subdir intact'
1345
1346
test_expect_success 'stash -- <subdir> works with binary files' '
1347
git reset &&
1348
+ mkdir -p subdir &&
1349
>subdir/untracked &&
1350
>subdir/tracked &&
1351
cp "$TEST_DIRECTORY"/test-binary-1.png subdir/tracked-binary &&