Git fork
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at reftables-rust 92 lines 2.0 kB view raw
1#!/bin/sh 2 3test_description='various Windows-only path tests' 4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7. ./test-lib.sh 8 9if test_have_prereq CYGWIN 10then 11 alias winpwd='cygpath -aw .' 12elif test_have_prereq MINGW 13then 14 alias winpwd=pwd 15else 16 skip_all='skipping Windows-only path tests' 17 test_done 18fi 19 20UNCPATH="$(winpwd)" 21case "$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 ;; 36esac 37 38test_expect_success setup ' 39 test_commit initial 40' 41 42test_expect_success clone ' 43 git clone "file://$UNCPATH" clone 44' 45 46test_expect_success 'clone without file://' ' 47 git clone "$UNCPATH" clone-without-file 48' 49 50test_expect_success 'clone with backslashed path' ' 51 BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" && 52 git clone "$BACKSLASHED" backslashed 53' 54 55test_expect_success fetch ' 56 git init to-fetch && 57 ( 58 cd to-fetch && 59 git fetch "$UNCPATH" main 60 ) 61' 62 63test_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 74test_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 80test_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 92test_done