]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5580-clone-push-unc.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t5580-clone-push-unc.sh
CommitLineData
16615f0f
JS
1#!/bin/sh
2
13b57da8 3test_description='various Windows-only path tests'
16615f0f
JS
4. ./test-lib.sh
5
f21d60b4
AD
6if test_have_prereq CYGWIN
7then
8 alias winpwd='cygpath -aw .'
9elif test_have_prereq MINGW
10then
11 alias winpwd=pwd
12else
13b57da8 13 skip_all='skipping Windows-only path tests'
16615f0f
JS
14 test_done
15fi
16
f21d60b4 17UNCPATH="$(winpwd)"
16615f0f
JS
18case "$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 ;;
33esac
34
35test_expect_success setup '
36 test_commit initial
37'
38
39test_expect_success clone '
40 git clone "file://$UNCPATH" clone
41'
42
9e9da23c 43test_expect_success 'clone with backslashed path' '
5440df44
JS
44 BACKSLASHED="$(echo "$UNCPATH" | tr / \\\\)" &&
45 git clone "$BACKSLASHED" backslashed
46'
47
16615f0f
JS
48test_expect_success push '
49 (
50 cd clone &&
51 git checkout -b to-push &&
52 test_commit to-push &&
53 git push origin HEAD
54 ) &&
55 rev="$(git -C clone rev-parse --verify refs/heads/to-push)" &&
56 test "$rev" = "$(git rev-parse --verify refs/heads/to-push)"
57'
58
f21d60b4
AD
59test_expect_success MINGW 'remote nick cannot contain backslashes' '
60 BACKSLASHED="$(winpwd | tr / \\\\)" &&
13b57da8
JS
61 git ls-remote "$BACKSLASHED" >out 2>err &&
62 test_i18ngrep ! "unable to access" err
63'
64
397a46db
JS
65test_expect_success 'unc alternates' '
66 tree="$(git rev-parse HEAD:)" &&
67 mkdir test-unc-alternate &&
68 (
69 cd test-unc-alternate &&
70 git init &&
71 test_must_fail git show $tree &&
72 echo "$UNCPATH/.git/objects" >.git/objects/info/alternates &&
73 git show $tree
74 )
75'
76
16615f0f 77test_done