3 test_description
='various Windows-only path tests'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_PASSES_SANITIZE_LEAK
=true
10 if test_have_prereq CYGWIN
12 alias winpwd
='cygpath -aw .'
13 elif test_have_prereq MINGW
17 skip_all
='skipping Windows-only path tests'
24 # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git
25 # (we use forward slashes here because MSYS2 and Git accept them, and
26 # they are easier on the eyes)
27 UNCPATH
="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}"
28 test -d "$UNCPATH" ||
{
29 skip_all
='could not access administrative share; skipping'
34 skip_all
='skipping UNC path tests, cannot determine current path as UNC'
39 test_expect_success setup
'
43 test_expect_success clone
'
44 git clone "file://$UNCPATH" clone
47 test_expect_success
'clone without file://' '
48 git clone "$UNCPATH" clone-without-file
51 test_expect_success
'clone with backslashed path' '
52 BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" &&
53 git clone "$BACKSLASHED" backslashed
56 test_expect_success fetch
'
60 git fetch "$UNCPATH" main
64 test_expect_success push
'
67 git checkout -b to-push &&
68 test_commit to-push &&
71 rev="$(git -C clone rev-parse --verify refs/heads/to-push)" &&
72 test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
75 test_expect_success MINGW
'remote nick cannot contain backslashes' '
76 BACKSLASHED="$(winpwd | tr / \\\\)" &&
77 git ls-remote "$BACKSLASHED" 2>err &&
78 test_i18ngrep ! "unable to access" err
81 test_expect_success
'unc alternates' '
82 tree="$(git rev-parse HEAD:)" &&
83 mkdir test-unc-alternate &&
85 cd test-unc-alternate &&
87 test_must_fail git show $tree &&
88 echo "$UNCPATH/.git/objects" >.git/objects/info/alternates &&