t5580: add Cygwin support

t5580 tests that specifying Windows UNC paths works with Git. Cygwin supports UNC paths, albeit only using forward slashes, not backslashes, so run the compatible tests on Cygwin as well as MinGW. The only complication is Cygwin's `pwd`, which returns a *nix-style path, and that's not suitable for calculating the UNC path to the current directory. Instead use Cygwin's `cygpath` utility to get the Windows-style path. Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org> Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Adam Dinwoodie committed Oct 31, 2017 at 13:19 UTC f21d60b4299378f4d99b9d234ae013f81661e838
1 file changed +10 -4
t/t5580-clone-push-unc.sh
+10 -4
@@ -3,12 +3,18 @@
3 test_description='various Windows-only path tests'
4 . ./test-lib.sh
5
6 -if ! test_have_prereq MINGW; then
6 +if test_have_prereq CYGWIN
7 +then
8 + alias winpwd='cygpath -aw .'
9 +elif test_have_prereq MINGW
10 +then
11 + alias winpwd=pwd
12 +else
13 skip_all='skipping Windows-only path tests'
14 test_done
15 fi
16
11 -UNCPATH="$(pwd)"
17 +UNCPATH="$(winpwd)"
18 case "$UNCPATH" in
19 [A-Z]:*)
20 # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
@@ -45,8 +51,8 @@ test_expect_success push '
51 test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
52 '
53
48 -test_expect_success 'remote nick cannot contain backslashes' '
49 - BACKSLASHED="$(pwd | tr / \\\\)" &&
54 +test_expect_success MINGW 'remote nick cannot contain backslashes' '
55 + BACKSLASHED="$(winpwd | tr / \\\\)" &&
56 git ls-remote "$BACKSLASHED" >out 2>err &&
57 test_i18ngrep ! "unable to access" err
58 '