]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0060-path-utils.sh
The sixth batch
[thirdparty/git.git] / t / t0060-path-utils.sh
CommitLineData
ae299be0
DR
1#!/bin/sh
2#
3# Copyright (c) 2008 David Reiss
4#
5
6test_description='Test various path utilities'
7
8. ./test-lib.sh
9
2718e852 10norm_path() {
b8d5cf4f 11 expected=$(test-tool path-utils print_path "$2")
2718e852 12 test_expect_success $3 "normalize path: $1 => $2" \
b8d5cf4f 13 "test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
ae299be0
DR
14}
15
203439b2 16relative_path() {
b8d5cf4f 17 expected=$(test-tool path-utils print_path "$3")
203439b2 18 test_expect_success $4 "relative path: $1 $2 => $3" \
b8d5cf4f 19 "test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
203439b2
JX
20}
21
63e95beb
SB
22test_submodule_relative_url() {
23 test_expect_success "test_submodule_relative_url: $1 $2 $3 => $4" "
24 actual=\$(git submodule--helper resolve-relative-url-test '$1' '$2' '$3') &&
25 test \"\$actual\" = '$4'
26 "
27}
28
557bd833
NTND
29test_git_path() {
30 test_expect_success "git-path $1 $2 => $3" "
31 $1 git rev-parse --git-path $2 >actual &&
32 echo $3 >expect &&
33 test_cmp expect actual
34 "
35}
36
2718e852
JS
37# On Windows, we are using MSYS's bash, which mangles the paths.
38# Absolute paths are anchored at the MSYS installation directory,
39# which means that the path / accounts for this many characters:
b8d5cf4f 40rootoff=$(test-tool path-utils normalize_path_copy / | wc -c)
2718e852 41# Account for the trailing LF:
28baf82e 42if test $rootoff = 2; then
2718e852
JS
43 rootoff= # we are on Unix
44else
45 rootoff=$(($rootoff-1))
fc56c7b3
JS
46 # In MSYS2, the root directory "/" is translated into a Windows
47 # directory *with* trailing slash. Let's test for that and adjust
48 # our expected longest ancestor length accordingly.
b8d5cf4f 49 case "$(test-tool path-utils print_path /)" in
fc56c7b3
JS
50 */) rootslash=1;;
51 *) rootslash=0;;
52 esac
2718e852
JS
53fi
54
0454dd93 55ancestor() {
2718e852
JS
56 # We do some math with the expected ancestor length.
57 expected=$3
58 if test -n "$rootoff" && test "x$expected" != x-1; then
fc56c7b3
JS
59 expected=$(($expected-$rootslash))
60 test $expected -lt 0 ||
2718e852
JS
61 expected=$(($expected+$rootoff))
62 fi
63 test_expect_success "longest ancestor: $1 $2 => $expected" \
b8d5cf4f 64 "actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
2718e852 65 test \"\$actual\" = '$expected'"
0454dd93
DR
66}
67
abd4284b
JX
68# Some absolute path tests should be skipped on Windows due to path mangling
69# on POSIX-style absolute paths
2718e852
JS
70case $(uname -s) in
71*MINGW*)
72 ;;
496f2569
TB
73*CYGWIN*)
74 ;;
2718e852
JS
75*)
76 test_set_prereq POSIX
77 ;;
78esac
79
b8d5cf4f
NTND
80test_expect_success basename 'test-tool path-utils basename'
81test_expect_success dirname 'test-tool path-utils dirname'
7d1aaa68 82
2718e852
JS
83norm_path "" ""
84norm_path . ""
85norm_path ./ ""
86norm_path ./. ""
87norm_path ./.. ++failed++
88norm_path ../. ++failed++
89norm_path ./../.// ++failed++
90norm_path dir/.. ""
91norm_path dir/sub/../.. ""
92norm_path dir/sub/../../.. ++failed++
93norm_path dir dir
94norm_path dir// dir/
95norm_path ./dir dir
96norm_path dir/. dir/
97norm_path dir///./ dir/
98norm_path dir//sub/.. dir/
99norm_path dir/sub/../ dir/
100norm_path dir/sub/../. dir/
101norm_path dir/s1/../s2/ dir/s2/
102norm_path d1/s1///s2/..//../s3/ d1/s3/
103norm_path d1/s1//../s2/../../d2 d2
104norm_path d1/.../d2 d1/.../d2
105norm_path d1/..././../d2 d1/d2
106
abd4284b 107norm_path / /
2718e852
JS
108norm_path // / POSIX
109norm_path /// / POSIX
abd4284b 110norm_path /. /
2718e852
JS
111norm_path /./ / POSIX
112norm_path /./.. ++failed++ POSIX
abd4284b 113norm_path /../. ++failed++
2718e852
JS
114norm_path /./../.// ++failed++ POSIX
115norm_path /dir/.. / POSIX
116norm_path /dir/sub/../.. / POSIX
117norm_path /dir/sub/../../.. ++failed++ POSIX
abd4284b
JX
118norm_path /dir /dir
119norm_path /dir// /dir/
120norm_path /./dir /dir
121norm_path /dir/. /dir/
122norm_path /dir///./ /dir/
123norm_path /dir//sub/.. /dir/
124norm_path /dir/sub/../ /dir/
2718e852 125norm_path //dir/sub/../. /dir/ POSIX
abd4284b
JX
126norm_path /dir/s1/../s2/ /dir/s2/
127norm_path /d1/s1///s2/..//../s3/ /d1/s3/
128norm_path /d1/s1//../s2/../../d2 /d2
129norm_path /d1/.../d2 /d1/.../d2
130norm_path /d1/..././../d2 /d1/d2
ae299be0 131
0454dd93 132ancestor / / -1
0454dd93
DR
133ancestor /foo / 0
134ancestor /foo /fo -1
135ancestor /foo /foo -1
0454dd93 136ancestor /foo /bar -1
0454dd93 137ancestor /foo /foo/bar -1
9e2326c7
MH
138ancestor /foo /foo:/bar -1
139ancestor /foo /:/foo:/bar 0
140ancestor /foo /foo:/:/bar 0
141ancestor /foo /:/bar:/foo 0
0454dd93
DR
142ancestor /foo/bar / 0
143ancestor /foo/bar /fo -1
0454dd93 144ancestor /foo/bar /foo 4
0454dd93
DR
145ancestor /foo/bar /foo/ba -1
146ancestor /foo/bar /:/fo 0
147ancestor /foo/bar /foo:/foo/ba 4
148ancestor /foo/bar /bar -1
9e2326c7
MH
149ancestor /foo/bar /fo -1
150ancestor /foo/bar /foo:/bar 4
151ancestor /foo/bar /:/foo:/bar 4
152ancestor /foo/bar /foo:/:/bar 4
153ancestor /foo/bar /:/bar:/fo 0
154ancestor /foo/bar /:/bar 0
155ancestor /foo/bar /foo 4
156ancestor /foo/bar /foo:/bar 4
157ancestor /foo/bar /bar -1
0454dd93 158
4fcc86b0 159test_expect_success 'strip_path_suffix' '
b8d5cf4f 160 test c:/msysgit = $(test-tool path-utils strip_path_suffix \
4fcc86b0
JS
161 c:/msysgit/libexec//git-core libexec/git-core)
162'
8da650b4 163
a0601dc1 164test_expect_success 'absolute path rejects the empty string' '
b8d5cf4f 165 test_must_fail test-tool path-utils absolute_path ""
17264bcc
MH
166'
167
f82a97eb
JS
168test_expect_success MINGW '<drive-letter>:\\abc is an absolute path' '
169 for letter in : \" C Z 1 ä
170 do
171 path=$letter:\\abc &&
14af7ed5 172 absolute="$(test-tool path-utils absolute_path "$path")" &&
f82a97eb
JS
173 test "$path" = "$absolute" || return 1
174 done
175'
176
3efe5d1d 177test_expect_success 'real path rejects the empty string' '
b8d5cf4f 178 test_must_fail test-tool path-utils real_path ""
a5c45218
MH
179'
180
bacca785 181test_expect_success POSIX 'real path works on absolute paths 1' '
7bcf48da 182 nopath="hopefully-absent-path" &&
b8d5cf4f
NTND
183 test "/" = "$(test-tool path-utils real_path "/")" &&
184 test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
bacca785
JS
185'
186
187test_expect_success 'real path works on absolute paths 2' '
188 nopath="hopefully-absent-path" &&
7bcf48da
MH
189 # Find an existing top-level directory for the remaining tests:
190 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
b8d5cf4f
NTND
191 test "$d" = "$(test-tool path-utils real_path "$d")" &&
192 test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
7bcf48da
MH
193'
194
379a03ad
MH
195test_expect_success POSIX 'real path removes extra leading slashes' '
196 nopath="hopefully-absent-path" &&
b8d5cf4f
NTND
197 test "/" = "$(test-tool path-utils real_path "///")" &&
198 test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
379a03ad
MH
199 # Find an existing top-level directory for the remaining tests:
200 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
b8d5cf4f
NTND
201 test "$d" = "$(test-tool path-utils real_path "//$d")" &&
202 test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
379a03ad
MH
203'
204
205test_expect_success 'real path removes other extra slashes' '
206 nopath="hopefully-absent-path" &&
207 # Find an existing top-level directory for the remaining tests:
208 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
b8d5cf4f
NTND
209 test "$d" = "$(test-tool path-utils real_path "$d///")" &&
210 test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
379a03ad
MH
211'
212
7bcf48da 213test_expect_success SYMLINKS 'real path works on symlinks' '
8da650b4
MH
214 mkdir first &&
215 ln -s ../.git first/.git &&
216 mkdir second &&
217 ln -s ../first second/other &&
218 mkdir third &&
219 dir="$(cd .git; pwd -P)" &&
220 dir2=third/../second/other/.git &&
b8d5cf4f 221 test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
8da650b4 222 file="$dir"/index &&
b8d5cf4f 223 test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
8da650b4 224 basename=blub &&
b8d5cf4f 225 test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
8da650b4
MH
226 ln -s ../first/file .git/syml &&
227 sym="$(cd first; pwd -P)"/file &&
b8d5cf4f 228 test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
8da650b4
MH
229'
230
655ee9ea 231test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
74af95d6 232 ln -s target symlink &&
b8d5cf4f 233 test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
74af95d6
MEW
234'
235
e5aa1fc4
MEW
236test_expect_success 'prefix_path works with only absolute path to work tree' '
237 echo "" >expected &&
b8d5cf4f 238 test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
e5aa1fc4
MEW
239 test_cmp expected actual
240'
241
e131daa4 242test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
b8d5cf4f 243 test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
e131daa4
MEW
244'
245
246test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' '
247 git init repo &&
248 ln -s repo repolink &&
b8d5cf4f 249 test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
e131daa4
MEW
250'
251
daf19a80
JX
252relative_path /foo/a/b/c/ /foo/a/b/ c/
253relative_path /foo/a/b/c/ /foo/a/b c/
254relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX
255relative_path /foo/a/b /foo/a/b ./
256relative_path /foo/a/b/ /foo/a/b ./
257relative_path /foo/a /foo/a/b ../
258relative_path / /foo/a/b/ ../../../
259relative_path /foo/a/c /foo/a/b/ ../c
260relative_path /foo/a/c /foo/a/b ../c
261relative_path /foo/x/y /foo/a/b/ ../../x/y
262relative_path /foo/a/b "<empty>" /foo/a/b
263relative_path /foo/a/b "<null>" /foo/a/b
264relative_path foo/a/b/c/ foo/a/b/ c/
265relative_path foo/a/b/c/ foo/a/b c/
266relative_path foo/a/b//c foo/a//b c
267relative_path foo/a/b/ foo/a/b/ ./
268relative_path foo/a/b/ foo/a/b ./
269relative_path foo/a foo/a/b ../
270relative_path foo/x/y foo/a/b ../../x/y
271relative_path foo/a/c foo/a/b ../c
7fbd4221
JX
272relative_path foo/a/b /foo/x/y foo/a/b
273relative_path /foo/a/b foo/x/y /foo/a/b
274relative_path d:/a/b D:/a/c ../b MINGW
275relative_path C:/a/b D:/a/c C:/a/b MINGW
daf19a80
JX
276relative_path foo/a/b "<empty>" foo/a/b
277relative_path foo/a/b "<null>" foo/a/b
278relative_path "<empty>" /foo/a/b ./
279relative_path "<empty>" "<empty>" ./
280relative_path "<empty>" "<null>" ./
281relative_path "<null>" "<empty>" ./
282relative_path "<null>" "<null>" ./
283relative_path "<null>" /foo/a/b ./
203439b2 284
557bd833
NTND
285test_git_path A=B info/grafts .git/info/grafts
286test_git_path GIT_GRAFT_FILE=foo info/grafts foo
287test_git_path GIT_GRAFT_FILE=foo info/////grafts foo
288test_git_path GIT_INDEX_FILE=foo index foo
289test_git_path GIT_INDEX_FILE=foo index/foo .git/index/foo
290test_git_path GIT_INDEX_FILE=foo index2 .git/index2
291test_expect_success 'setup fake objects directory foo' 'mkdir foo'
292test_git_path GIT_OBJECT_DIRECTORY=foo objects foo
293test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo
294test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2
c7b3a3d2
NTND
295test_expect_success 'setup common repository' 'git --git-dir=bar init'
296test_git_path GIT_COMMON_DIR=bar index .git/index
76a53d64 297test_git_path GIT_COMMON_DIR=bar index.lock .git/index.lock
c7b3a3d2
NTND
298test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD
299test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD
76a53d64 300test_git_path GIT_COMMON_DIR=bar logs/HEAD.lock .git/logs/HEAD.lock
ce414b33 301test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo
f45f88b2
SG
302test_git_path GIT_COMMON_DIR=bar logs/refs bar/logs/refs
303test_git_path GIT_COMMON_DIR=bar logs/refs/ bar/logs/refs/
ce414b33
DT
304test_git_path GIT_COMMON_DIR=bar logs/refs/bisec/foo bar/logs/refs/bisec/foo
305test_git_path GIT_COMMON_DIR=bar logs/refs/bisec bar/logs/refs/bisec
306test_git_path GIT_COMMON_DIR=bar logs/refs/bisectfoo bar/logs/refs/bisectfoo
c7b3a3d2
NTND
307test_git_path GIT_COMMON_DIR=bar objects bar/objects
308test_git_path GIT_COMMON_DIR=bar objects/bar bar/objects/bar
309test_git_path GIT_COMMON_DIR=bar info/exclude bar/info/exclude
310test_git_path GIT_COMMON_DIR=bar info/grafts bar/info/grafts
6cfbdcb2 311test_git_path GIT_COMMON_DIR=bar info/sparse-checkout .git/info/sparse-checkout
4e09cf2a 312test_git_path GIT_COMMON_DIR=bar info//sparse-checkout .git/info//sparse-checkout
c7b3a3d2
NTND
313test_git_path GIT_COMMON_DIR=bar remotes/bar bar/remotes/bar
314test_git_path GIT_COMMON_DIR=bar branches/bar bar/branches/bar
315test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master bar/logs/refs/heads/master
316test_git_path GIT_COMMON_DIR=bar refs/heads/master bar/refs/heads/master
ce414b33 317test_git_path GIT_COMMON_DIR=bar refs/bisect/foo .git/refs/bisect/foo
c7b3a3d2
NTND
318test_git_path GIT_COMMON_DIR=bar hooks/me bar/hooks/me
319test_git_path GIT_COMMON_DIR=bar config bar/config
320test_git_path GIT_COMMON_DIR=bar packed-refs bar/packed-refs
321test_git_path GIT_COMMON_DIR=bar shallow bar/shallow
8aff1a9c
NTND
322test_git_path GIT_COMMON_DIR=bar common bar/common
323test_git_path GIT_COMMON_DIR=bar common/file bar/common/file
557bd833 324
77b63ac3
JS
325# In the tests below, $(pwd) must be used because it is a native path on
326# Windows and avoids MSYS's path mangling (which simplifies "foo/../bar" and
327# strips the dot from trailing "/.").
63e95beb
SB
328
329test_submodule_relative_url "../" "../foo" "../submodule" "../../submodule"
330test_submodule_relative_url "../" "../foo/bar" "../submodule" "../../foo/submodule"
331test_submodule_relative_url "../" "../foo/submodule" "../submodule" "../../foo/submodule"
332test_submodule_relative_url "../" "./foo" "../submodule" "../submodule"
333test_submodule_relative_url "../" "./foo/bar" "../submodule" "../foo/submodule"
334test_submodule_relative_url "../../../" "../foo/bar" "../sub/a/b/c" "../../../../foo/sub/a/b/c"
77b63ac3 335test_submodule_relative_url "../" "$(pwd)/addtest" "../repo" "$(pwd)/repo"
63e95beb
SB
336test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule"
337test_submodule_relative_url "../" "foo" "../submodule" "../submodule"
338
339test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c" "../foo/sub/a/b/c"
3389e78e 340test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c/" "../foo/sub/a/b/c"
08788504 341test_submodule_relative_url "(null)" "../foo/bar/" "../sub/a/b/c" "../foo/sub/a/b/c"
63e95beb
SB
342test_submodule_relative_url "(null)" "../foo/bar" "../submodule" "../foo/submodule"
343test_submodule_relative_url "(null)" "../foo/submodule" "../submodule" "../foo/submodule"
344test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule"
345test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule"
346test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule"
347test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo"
2711b1ad
ÆAB
348test_submodule_relative_url "(null)" "//somewhere else/repo" "../../subrepo" "//subrepo"
349test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../subrepo" "/subrepo"
350test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../../subrepo" "subrepo"
77b63ac3
JS
351test_submodule_relative_url "(null)" "$(pwd)/subsuper_update_r" "../subsubsuper_update_r" "$(pwd)/subsubsuper_update_r"
352test_submodule_relative_url "(null)" "$(pwd)/super_update_r2" "../subsuper_update_r" "$(pwd)/subsuper_update_r"
353test_submodule_relative_url "(null)" "$(pwd)/." "../." "$(pwd)/."
354test_submodule_relative_url "(null)" "$(pwd)" "./." "$(pwd)/."
355test_submodule_relative_url "(null)" "$(pwd)/addtest" "../repo" "$(pwd)/repo"
356test_submodule_relative_url "(null)" "$(pwd)" "./å äö" "$(pwd)/å äö"
357test_submodule_relative_url "(null)" "$(pwd)/." "../submodule" "$(pwd)/submodule"
358test_submodule_relative_url "(null)" "$(pwd)/submodule" "../submodule" "$(pwd)/submodule"
359test_submodule_relative_url "(null)" "$(pwd)/home2/../remote" "../bundle1" "$(pwd)/home2/../bundle1"
360test_submodule_relative_url "(null)" "$(pwd)/submodule_update_repo" "./." "$(pwd)/submodule_update_repo/."
63e95beb
SB
361test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tmp/subrepo"
362test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule"
363test_submodule_relative_url "(null)" "foo" "../submodule" "submodule"
364test_submodule_relative_url "(null)" "helper:://hostname/repo" "../subrepo" "helper:://hostname/subrepo"
2711b1ad
ÆAB
365test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../subrepo" "helper:://subrepo"
366test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../subrepo" "helper::/subrepo"
367test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../subrepo" "helper::subrepo"
368test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../subrepo" "helper:subrepo"
369test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../../subrepo" ".:subrepo"
63e95beb 370test_submodule_relative_url "(null)" "ssh://hostname/repo" "../subrepo" "ssh://hostname/subrepo"
2711b1ad
ÆAB
371test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../subrepo" "ssh://subrepo"
372test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../subrepo" "ssh:/subrepo"
373test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../subrepo" "ssh:subrepo"
374test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../../subrepo" ".:subrepo"
63e95beb
SB
375test_submodule_relative_url "(null)" "ssh://hostname:22/repo" "../subrepo" "ssh://hostname:22/subrepo"
376test_submodule_relative_url "(null)" "user@host:path/to/repo" "../subrepo" "user@host:path/to/subrepo"
377test_submodule_relative_url "(null)" "user@host:repo" "../subrepo" "user@host:subrepo"
2711b1ad 378test_submodule_relative_url "(null)" "user@host:repo" "../../subrepo" ".:subrepo"
63e95beb 379
dc2d9ba3 380test_expect_success 'match .gitmodules' '
7913f53b 381 test-tool path-utils is_dotgitmodules \
dc2d9ba3
JS
382 .gitmodules \
383 \
384 .git${u200c}modules \
385 \
386 .Gitmodules \
387 .gitmoduleS \
388 \
389 ".gitmodules " \
390 ".gitmodules." \
391 ".gitmodules " \
392 ".gitmodules. " \
393 ".gitmodules ." \
394 ".gitmodules.." \
395 ".gitmodules " \
396 ".gitmodules. " \
397 ".gitmodules . " \
398 ".gitmodules ." \
399 \
400 ".Gitmodules " \
401 ".Gitmodules." \
402 ".Gitmodules " \
403 ".Gitmodules. " \
404 ".Gitmodules ." \
405 ".Gitmodules.." \
406 ".Gitmodules " \
407 ".Gitmodules. " \
408 ".Gitmodules . " \
409 ".Gitmodules ." \
410 \
411 GITMOD~1 \
412 gitmod~1 \
413 GITMOD~2 \
414 gitmod~3 \
415 GITMOD~4 \
416 \
417 "GITMOD~1 " \
418 "gitmod~2." \
419 "GITMOD~3 " \
420 "gitmod~4. " \
421 "GITMOD~1 ." \
422 "gitmod~2 " \
423 "GITMOD~3. " \
424 "gitmod~4 . " \
425 \
426 GI7EBA~1 \
427 gi7eba~9 \
428 \
429 GI7EB~10 \
430 GI7EB~11 \
431 GI7EB~99 \
432 GI7EB~10 \
433 GI7E~100 \
434 GI7E~101 \
435 GI7E~999 \
436 ~1000000 \
437 ~9999999 \
438 \
91bd4658
JS
439 .gitmodules:\$DATA \
440 "gitmod~4 . :\$DATA" \
441 \
dc2d9ba3
JS
442 --not \
443 ".gitmodules x" \
444 ".gitmodules .x" \
445 \
446 " .gitmodules" \
447 \
448 ..gitmodules \
449 \
450 gitmodules \
451 \
452 .gitmodule \
453 \
454 ".gitmodules x " \
455 ".gitmodules .x" \
456 \
457 GI7EBA~ \
458 GI7EBA~0 \
459 GI7EBA~~1 \
460 GI7EBA~X \
461 Gx7EBA~1 \
462 GI7EBX~1 \
463 \
464 GI7EB~1 \
465 GI7EB~01 \
91bd4658
JS
466 GI7EB~1X \
467 \
468 .gitmodules,:\$DATA
dc2d9ba3
JS
469'
470
d2c84dad 471test_expect_success MINGW 'is_valid_path() on Windows' '
4dc42c6c 472 test-tool path-utils is_valid_path \
d2c84dad
JS
473 win32 \
474 "win32 x" \
475 ../hello.txt \
817ddd64 476 C:\\git \
4dc42c6c
JS
477 comm \
478 conout.c \
b6852e19 479 com0.c \
4dc42c6c 480 lptN \
d2c84dad
JS
481 \
482 --not \
483 "win32 " \
484 "win32 /x " \
485 "win32." \
486 "win32 . ." \
817ddd64 487 .../hello.txt \
4dc42c6c
JS
488 colon:test \
489 "AUX.c" \
490 "abc/conOut\$ .xyz/test" \
491 lpt8 \
b6852e19 492 com9.c \
4dc42c6c
JS
493 "lpt*" \
494 Nul \
495 "PRN./abc"
dc2d9ba3
JS
496'
497
ae299be0 498test_done