Skip to content

Commit 4dbf7f3

Browse files
newrengitster
authored andcommitted
t3903: document a pair of directory/file bugs
There are three tests here, because the second bug is documented with two tests: a file -> directory change and a directory -> file change. The reason for the two tests is just to verify that both are indeed broken but that both will be fixed by the same simple change (which will be provided in a subsequent patch). Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 225bc32 commit 4dbf7f3

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

t/t3903-stash.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,4 +1307,62 @@ test_expect_success 'stash -c stash.useBuiltin=false warning ' '
13071307
test_must_be_empty err
13081308
'
13091309

1310+
test_expect_failure 'git stash succeeds despite directory/file change' '
1311+
test_create_repo directory_file_switch_v1 &&
1312+
(
1313+
cd directory_file_switch_v1 &&
1314+
test_commit init &&
1315+
1316+
test_write_lines this file has some words >filler &&
1317+
git add filler &&
1318+
git commit -m filler &&
1319+
1320+
git rm filler &&
1321+
mkdir filler &&
1322+
echo contents >filler/file &&
1323+
git stash push
1324+
)
1325+
'
1326+
1327+
test_expect_failure 'git stash can pop file -> directory saved changes' '
1328+
test_create_repo directory_file_switch_v2 &&
1329+
(
1330+
cd directory_file_switch_v2 &&
1331+
test_commit init &&
1332+
1333+
test_write_lines this file has some words >filler &&
1334+
git add filler &&
1335+
git commit -m filler &&
1336+
1337+
git rm filler &&
1338+
mkdir filler &&
1339+
echo contents >filler/file &&
1340+
cp filler/file expect &&
1341+
git stash push --include-untracked &&
1342+
git stash apply --index &&
1343+
test_cmp expect filler/file
1344+
)
1345+
'
1346+
1347+
test_expect_failure 'git stash can pop directory -> file saved changes' '
1348+
test_create_repo directory_file_switch_v3 &&
1349+
(
1350+
cd directory_file_switch_v3 &&
1351+
test_commit init &&
1352+
1353+
mkdir filler &&
1354+
test_write_lines some words >filler/file1 &&
1355+
test_write_lines and stuff >filler/file2 &&
1356+
git add filler &&
1357+
git commit -m filler &&
1358+
1359+
git rm -rf filler &&
1360+
echo contents >filler &&
1361+
cp filler expect &&
1362+
git stash push --include-untracked &&
1363+
git stash apply --index &&
1364+
test_cmp expect filler
1365+
)
1366+
'
1367+
13101368
test_done

0 commit comments

Comments
 (0)