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