]>
Commit | Line | Data |
---|---|---|
16615f0f JS |
1 | #!/bin/sh |
2 | ||
13b57da8 | 3 | test_description='various Windows-only path tests' |
16615f0f JS |
4 | . ./test-lib.sh |
5 | ||
f21d60b4 AD |
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 | |
13b57da8 | 13 | skip_all='skipping Windows-only path tests' |
16615f0f JS |
14 | test_done |
15 | fi | |
16 | ||
f21d60b4 | 17 | UNCPATH="$(winpwd)" |
16615f0f JS |
18 | case "$UNCPATH" in |
19 | [A-Z]:*) | |
20 | # Use administrative share e.g. \\localhost\C$\git-sdk-64\usr\src\git | |
21 | # (we use forward slashes here because MSYS2 and Git accept them, and | |
22 | # they are easier on the eyes) | |
23 | UNCPATH="//localhost/${UNCPATH%%:*}\$/${UNCPATH#?:}" | |
24 | test -d "$UNCPATH" || { | |
25 | skip_all='could not access administrative share; skipping' | |
26 | test_done | |
27 | } | |
28 | ;; | |
29 | *) | |
30 | skip_all='skipping UNC path tests, cannot determine current path as UNC' | |
31 | test_done | |
32 | ;; | |
33 | esac | |
34 | ||
35 | test_expect_success setup ' | |
36 | test_commit initial | |
37 | ' | |
38 | ||
39 | test_expect_success clone ' | |
40 | git clone "file://$UNCPATH" clone | |
41 | ' | |
42 | ||
bfe2bbb4 JS |
43 | test_expect_success 'clone without file://' ' |
44 | git clone "$UNCPATH" clone-without-file | |
45 | ' | |
46 | ||
9e9da23c | 47 | test_expect_success 'clone with backslashed path' ' |
5440df44 JS |
48 | BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" && |
49 | git clone "$BACKSLASHED" backslashed | |
50 | ' | |
51 | ||
bfe2bbb4 JS |
52 | test_expect_success fetch ' |
53 | git init to-fetch && | |
54 | ( | |
55 | cd to-fetch && | |
56 | git fetch "$UNCPATH" master | |
57 | ) | |
58 | ' | |
59 | ||
16615f0f JS |
60 | test_expect_success push ' |
61 | ( | |
62 | cd clone && | |
63 | git checkout -b to-push && | |
64 | test_commit to-push && | |
65 | git push origin HEAD | |
66 | ) && | |
67 | rev="$(git -C clone rev-parse --verify refs/heads/to-push)" && | |
68 | test "$rev" = "$(git rev-parse --verify refs/heads/to-push)" | |
69 | ' | |
70 | ||
f21d60b4 AD |
71 | test_expect_success MINGW 'remote nick cannot contain backslashes' ' |
72 | BACKSLASHED="$(winpwd | tr / \\\\)" && | |
01ed17dc | 73 | git ls-remote "$BACKSLASHED" 2>err && |
13b57da8 JS |
74 | test_i18ngrep ! "unable to access" err |
75 | ' | |
76 | ||
397a46db JS |
77 | test_expect_success 'unc alternates' ' |
78 | tree="$(git rev-parse HEAD:)" && | |
79 | mkdir test-unc-alternate && | |
80 | ( | |
81 | cd test-unc-alternate && | |
82 | git init && | |
83 | test_must_fail git show $tree && | |
84 | echo "$UNCPATH/.git/objects" >.git/objects/info/alternates && | |
85 | git show $tree | |
86 | ) | |
87 | ' | |
88 | ||
16615f0f | 89 | test_done |