3 test_description
='various Windows-only path tests'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9 if test_have_prereq CYGWIN
11 alias winpwd
='cygpath -aw .'
12 elif test_have_prereq MINGW
16 skip_all
='skipping Windows-only path tests'
23 # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
24 # (we use forward slashes here because MSYS2 and Git accept them, and
25 # they are easier on the eyes)
26 UNCPATH
="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}"
27 test -d "$UNCPATH" ||
{
28 skip_all
='could not access administrative share; skipping'
33 skip_all
='skipping UNC path tests, cannot determine current path as UNC'
38 test_expect_success setup
'
42 test_expect_success clone
'
43 git clone "file://$UNCPATH" clone
46 test_expect_success
'clone without file://' '
47 git clone "$UNCPATH" clone-without-file
50 test_expect_success
'clone with backslashed path' '
51 BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" &&
52 git clone "$BACKSLASHED" backslashed
55 test_expect_success fetch
'
59 git fetch "$UNCPATH" main
63 test_expect_success push
'
66 git checkout -b to-push &&
67 test_commit to-push &&
70 rev="$(git -C clone rev-parse --verify refs/heads/to-push)" &&
71 test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
74 test_expect_success MINGW
'remote nick cannot contain backslashes' '
75 BACKSLASHED="$(winpwd | tr / \\\\)" &&
76 git ls-remote "$BACKSLASHED" 2>err &&
77 test_i18ngrep ! "unable to access" err
80 test_expect_success
'unc alternates' '
81 tree="$(git rev-parse HEAD:)" &&
82 mkdir test-unc-alternate &&
84 cd test-unc-alternate &&
86 test_must_fail git show $tree &&
87 echo "$UNCPATH/.git/objects" >.git/objects/info/alternates &&