Skip to content

Commit 6d340df

Browse files
me-andgitster
authored andcommitted
t9902: split test to run on appropriate systems
The "FUNNYNAMES" test prerequisite passes on Cygwin, as the Cygwin file system interface has a workaround for the underlying operating system's lack of support for tabs, newlines or quotes. However, it does not add support for backslash, which is treated as a directory separator, meaning one of the tests added by 4880382 ("completion: handle unusual characters for sparse-checkout", 2022-02-07) will fail on Cygwin. To avoid this failure while still getting maximal test coverage, split that test into two: test handling of paths that include tabs on anything that has the FUNNYNAMES prerequisite, but skip testing handling of paths that include backslashes unless both FUNNYNAMES is set and the system is not Cygwin. It might be nice to have more granularity than "FUNNYNAMES" and its sibling "FUNNIERNAMES" provide, so that tests could be run based on specific individual characters supported by the file system being tested, but that seems like it would make the prerequisite checks in this area much more verbose for very little gain. Signed-off-by: Adam Dinwoodie <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4880382 commit 6d340df

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

t/t9902-completion.sh

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,28 +1529,45 @@ test_expect_success 'cone mode sparse-checkout completes directory names with sp
15291529
)
15301530
'
15311531

1532-
# use FUNNYNAMES to avoid running on Windows, which doesn't permit backslashes or tabs in paths
1533-
test_expect_success FUNNYNAMES 'cone mode sparse-checkout completes directory names with backslashes and tabs' '
1532+
# use FUNNYNAMES to avoid running on Windows, which doesn't permit tabs in paths
1533+
test_expect_success FUNNYNAMES 'cone mode sparse-checkout completes directory names with tabs' '
15341534
# reset sparse-checkout
15351535
git -C sparse-checkout sparse-checkout disable &&
15361536
(
15371537
cd sparse-checkout &&
1538-
mkdir "directory\with\backslashes" &&
15391538
mkdir "$(printf "directory\twith\ttabs")" &&
1540-
>"directory\with\backslashes/randomfile" &&
15411539
>"$(printf "directory\twith\ttabs")/randomfile" &&
15421540
git add . &&
1543-
git commit -m "Add directory with backslashes and directory with tabs" &&
1544-
git sparse-checkout set --cone "directory\with\backslashes" \
1541+
git commit -m "Add directory with tabs" &&
1542+
git sparse-checkout set --cone \
15451543
"$(printf "directory\twith\ttabs")" &&
15461544
test_completion "git sparse-checkout add dir" <<-\EOF &&
1547-
directory\with\backslashes/
15481545
directory with tabs/
15491546
EOF
1550-
rm -rf "directory\with\backslashes" &&
15511547
rm -rf "$(printf "directory\twith\ttabs")" &&
15521548
git add . &&
1553-
git commit -m "Remove directory with backslashes and directory with tabs"
1549+
git commit -m "Remove directory with tabs"
1550+
)
1551+
'
1552+
1553+
# use FUNNYNAMES to avoid running on Windows, and !CYGWIN for Cygwin, as neither permit backslashes in paths
1554+
test_expect_success FUNNYNAMES,!CYGWIN 'cone mode sparse-checkout completes directory names with backslashes' '
1555+
# reset sparse-checkout
1556+
git -C sparse-checkout sparse-checkout disable &&
1557+
(
1558+
cd sparse-checkout &&
1559+
mkdir "directory\with\backslashes" &&
1560+
>"directory\with\backslashes/randomfile" &&
1561+
git add . &&
1562+
git commit -m "Add directory with backslashes" &&
1563+
git sparse-checkout set --cone \
1564+
"directory\with\backslashes" &&
1565+
test_completion "git sparse-checkout add dir" <<-\EOF &&
1566+
directory\with\backslashes/
1567+
EOF
1568+
rm -rf "directory\with\backslashes" &&
1569+
git add . &&
1570+
git commit -m "Remove directory with backslashes"
15541571
)
15551572
'
15561573

0 commit comments

Comments
 (0)