Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5580-unc-paths.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5580-unc-paths.sh` 92 lines ยท 1998 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='various Windows-only path tests' 4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh 8 9 if test_have_prereq CYGWIN 10 then 11 alias winpwd='cygpath -aw .' 12 elif test_have_prereq MINGW 13 then 14 alias winpwd=pwd 15 else 16 skip_all='skipping Windows-only path tests' 17 test_done 18 fi 19 20 UNCPATH="$(winpwd)" 21 case "$UNCPATH" in 22 [A-Z]:*) 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' 29 test_done 30 } 31 ;; 32 *) 33 skip_all='skipping UNC path tests, cannot determine current path as UNC' 34 test_done 35 ;; 36 esac 37 38 test_expect_success setup ' 39 test_commit initial 40 ' 41 42 test_expect_success clone ' 43 git clone "file://$UNCPATH" clone 44 ' 45 46 test_expect_success 'clone without file://' ' 47 git clone "$UNCPATH" clone-without-file 48 ' 49 50 test_expect_success 'clone with backslashed path' ' 51 BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" && 52 git clone "$BACKSLASHED" backslashed 53 ' 54 55 test_expect_success fetch ' 56 git init to-fetch && 57 ( 58 cd to-fetch && 59 git fetch "$UNCPATH" main 60 ) 61 ' 62 63 test_expect_success push ' 64 ( 65 cd clone && 66 git checkout -b to-push && 67 test_commit to-push && 68 git push origin HEAD 69 ) && 70 rev="$(git -C clone rev-parse --verify refs/heads/to-push)" && 71 test "$rev" = "$(git rev-parse --verify refs/heads/to-push)" 72 ' 73 74 test_expect_success MINGW 'remote nick cannot contain backslashes' ' 75 BACKSLASHED="$(winpwd | tr / \\\\)" && 76 git ls-remote "$BACKSLASHED" 2>err && 77 test_grep ! "unable to access" err 78 ' 79 80 test_expect_success 'unc alternates' ' 81 tree="$(git rev-parse HEAD:)" && 82 mkdir test-unc-alternate && 83 ( 84 cd test-unc-alternate && 85 git init && 86 test_must_fail git show $tree && 87 echo "$UNCPATH/.git/objects" >.git/objects/info/alternates && 88 git show $tree 89 ) 90 ' 91 92 test_done