]>
Commit | Line | Data |
---|---|---|
ae299be0 DR |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2008 David Reiss | |
4 | # | |
5 | ||
6 | test_description='Test various path utilities' | |
7 | ||
8 | . ./test-lib.sh | |
9 | ||
2718e852 | 10 | norm_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 | 16 | relative_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 |
22 | test_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 |
29 | test_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 | 40 | rootoff=$(test-tool path-utils normalize_path_copy / | wc -c) |
2718e852 | 41 | # Account for the trailing LF: |
28baf82e | 42 | if test $rootoff = 2; then |
2718e852 JS |
43 | rootoff= # we are on Unix |
44 | else | |
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 |
53 | fi |
54 | ||
0454dd93 | 55 | ancestor() { |
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 |
70 | case $(uname -s) in |
71 | *MINGW*) | |
72 | ;; | |
496f2569 TB |
73 | *CYGWIN*) |
74 | ;; | |
2718e852 JS |
75 | *) |
76 | test_set_prereq POSIX | |
77 | ;; | |
78 | esac | |
79 | ||
b8d5cf4f NTND |
80 | test_expect_success basename 'test-tool path-utils basename' |
81 | test_expect_success dirname 'test-tool path-utils dirname' | |
7d1aaa68 | 82 | |
2718e852 JS |
83 | norm_path "" "" |
84 | norm_path . "" | |
85 | norm_path ./ "" | |
86 | norm_path ./. "" | |
87 | norm_path ./.. ++failed++ | |
88 | norm_path ../. ++failed++ | |
89 | norm_path ./../.// ++failed++ | |
90 | norm_path dir/.. "" | |
91 | norm_path dir/sub/../.. "" | |
92 | norm_path dir/sub/../../.. ++failed++ | |
93 | norm_path dir dir | |
94 | norm_path dir// dir/ | |
95 | norm_path ./dir dir | |
96 | norm_path dir/. dir/ | |
97 | norm_path dir///./ dir/ | |
98 | norm_path dir//sub/.. dir/ | |
99 | norm_path dir/sub/../ dir/ | |
100 | norm_path dir/sub/../. dir/ | |
101 | norm_path dir/s1/../s2/ dir/s2/ | |
102 | norm_path d1/s1///s2/..//../s3/ d1/s3/ | |
103 | norm_path d1/s1//../s2/../../d2 d2 | |
104 | norm_path d1/.../d2 d1/.../d2 | |
105 | norm_path d1/..././../d2 d1/d2 | |
106 | ||
abd4284b | 107 | norm_path / / |
2718e852 JS |
108 | norm_path // / POSIX |
109 | norm_path /// / POSIX | |
abd4284b | 110 | norm_path /. / |
2718e852 JS |
111 | norm_path /./ / POSIX |
112 | norm_path /./.. ++failed++ POSIX | |
abd4284b | 113 | norm_path /../. ++failed++ |
2718e852 JS |
114 | norm_path /./../.// ++failed++ POSIX |
115 | norm_path /dir/.. / POSIX | |
116 | norm_path /dir/sub/../.. / POSIX | |
117 | norm_path /dir/sub/../../.. ++failed++ POSIX | |
abd4284b JX |
118 | norm_path /dir /dir |
119 | norm_path /dir// /dir/ | |
120 | norm_path /./dir /dir | |
121 | norm_path /dir/. /dir/ | |
122 | norm_path /dir///./ /dir/ | |
123 | norm_path /dir//sub/.. /dir/ | |
124 | norm_path /dir/sub/../ /dir/ | |
2718e852 | 125 | norm_path //dir/sub/../. /dir/ POSIX |
abd4284b JX |
126 | norm_path /dir/s1/../s2/ /dir/s2/ |
127 | norm_path /d1/s1///s2/..//../s3/ /d1/s3/ | |
128 | norm_path /d1/s1//../s2/../../d2 /d2 | |
129 | norm_path /d1/.../d2 /d1/.../d2 | |
130 | norm_path /d1/..././../d2 /d1/d2 | |
ae299be0 | 131 | |
0454dd93 | 132 | ancestor / / -1 |
0454dd93 DR |
133 | ancestor /foo / 0 |
134 | ancestor /foo /fo -1 | |
135 | ancestor /foo /foo -1 | |
0454dd93 | 136 | ancestor /foo /bar -1 |
0454dd93 | 137 | ancestor /foo /foo/bar -1 |
9e2326c7 MH |
138 | ancestor /foo /foo:/bar -1 |
139 | ancestor /foo /:/foo:/bar 0 | |
140 | ancestor /foo /foo:/:/bar 0 | |
141 | ancestor /foo /:/bar:/foo 0 | |
0454dd93 DR |
142 | ancestor /foo/bar / 0 |
143 | ancestor /foo/bar /fo -1 | |
0454dd93 | 144 | ancestor /foo/bar /foo 4 |
0454dd93 DR |
145 | ancestor /foo/bar /foo/ba -1 |
146 | ancestor /foo/bar /:/fo 0 | |
147 | ancestor /foo/bar /foo:/foo/ba 4 | |
148 | ancestor /foo/bar /bar -1 | |
9e2326c7 MH |
149 | ancestor /foo/bar /fo -1 |
150 | ancestor /foo/bar /foo:/bar 4 | |
151 | ancestor /foo/bar /:/foo:/bar 4 | |
152 | ancestor /foo/bar /foo:/:/bar 4 | |
153 | ancestor /foo/bar /:/bar:/fo 0 | |
154 | ancestor /foo/bar /:/bar 0 | |
155 | ancestor /foo/bar /foo 4 | |
156 | ancestor /foo/bar /foo:/bar 4 | |
157 | ancestor /foo/bar /bar -1 | |
0454dd93 | 158 | |
4fcc86b0 | 159 | test_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 | 164 | test_expect_success 'absolute path rejects the empty string' ' |
b8d5cf4f | 165 | test_must_fail test-tool path-utils absolute_path "" |
17264bcc MH |
166 | ' |
167 | ||
3efe5d1d | 168 | test_expect_success 'real path rejects the empty string' ' |
b8d5cf4f | 169 | test_must_fail test-tool path-utils real_path "" |
a5c45218 MH |
170 | ' |
171 | ||
bacca785 | 172 | test_expect_success POSIX 'real path works on absolute paths 1' ' |
7bcf48da | 173 | nopath="hopefully-absent-path" && |
b8d5cf4f NTND |
174 | test "/" = "$(test-tool path-utils real_path "/")" && |
175 | test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")" | |
bacca785 JS |
176 | ' |
177 | ||
178 | test_expect_success 'real path works on absolute paths 2' ' | |
179 | nopath="hopefully-absent-path" && | |
7bcf48da MH |
180 | # Find an existing top-level directory for the remaining tests: |
181 | d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") && | |
b8d5cf4f NTND |
182 | test "$d" = "$(test-tool path-utils real_path "$d")" && |
183 | test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")" | |
7bcf48da MH |
184 | ' |
185 | ||
379a03ad MH |
186 | test_expect_success POSIX 'real path removes extra leading slashes' ' |
187 | nopath="hopefully-absent-path" && | |
b8d5cf4f NTND |
188 | test "/" = "$(test-tool path-utils real_path "///")" && |
189 | test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" && | |
379a03ad MH |
190 | # Find an existing top-level directory for the remaining tests: |
191 | d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") && | |
b8d5cf4f NTND |
192 | test "$d" = "$(test-tool path-utils real_path "//$d")" && |
193 | test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")" | |
379a03ad MH |
194 | ' |
195 | ||
196 | test_expect_success 'real path removes other extra slashes' ' | |
197 | nopath="hopefully-absent-path" && | |
198 | # Find an existing top-level directory for the remaining tests: | |
199 | d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") && | |
b8d5cf4f NTND |
200 | test "$d" = "$(test-tool path-utils real_path "$d///")" && |
201 | test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")" | |
379a03ad MH |
202 | ' |
203 | ||
7bcf48da | 204 | test_expect_success SYMLINKS 'real path works on symlinks' ' |
8da650b4 MH |
205 | mkdir first && |
206 | ln -s ../.git first/.git && | |
207 | mkdir second && | |
208 | ln -s ../first second/other && | |
209 | mkdir third && | |
210 | dir="$(cd .git; pwd -P)" && | |
211 | dir2=third/../second/other/.git && | |
b8d5cf4f | 212 | test "$dir" = "$(test-tool path-utils real_path $dir2)" && |
8da650b4 | 213 | file="$dir"/index && |
b8d5cf4f | 214 | test "$file" = "$(test-tool path-utils real_path $dir2/index)" && |
8da650b4 | 215 | basename=blub && |
b8d5cf4f | 216 | test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" && |
8da650b4 MH |
217 | ln -s ../first/file .git/syml && |
218 | sym="$(cd first; pwd -P)"/file && | |
b8d5cf4f | 219 | test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")" |
8da650b4 MH |
220 | ' |
221 | ||
655ee9ea | 222 | test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' ' |
74af95d6 | 223 | ln -s target symlink && |
b8d5cf4f | 224 | test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink" |
74af95d6 MEW |
225 | ' |
226 | ||
e5aa1fc4 MEW |
227 | test_expect_success 'prefix_path works with only absolute path to work tree' ' |
228 | echo "" >expected && | |
b8d5cf4f | 229 | test-tool path-utils prefix_path prefix "$(pwd)" >actual && |
e5aa1fc4 MEW |
230 | test_cmp expected actual |
231 | ' | |
232 | ||
e131daa4 | 233 | test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' ' |
b8d5cf4f | 234 | test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a" |
e131daa4 MEW |
235 | ' |
236 | ||
237 | test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' ' | |
238 | git init repo && | |
239 | ln -s repo repolink && | |
b8d5cf4f | 240 | test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")" |
e131daa4 MEW |
241 | ' |
242 | ||
daf19a80 JX |
243 | relative_path /foo/a/b/c/ /foo/a/b/ c/ |
244 | relative_path /foo/a/b/c/ /foo/a/b c/ | |
245 | relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX | |
246 | relative_path /foo/a/b /foo/a/b ./ | |
247 | relative_path /foo/a/b/ /foo/a/b ./ | |
248 | relative_path /foo/a /foo/a/b ../ | |
249 | relative_path / /foo/a/b/ ../../../ | |
250 | relative_path /foo/a/c /foo/a/b/ ../c | |
251 | relative_path /foo/a/c /foo/a/b ../c | |
252 | relative_path /foo/x/y /foo/a/b/ ../../x/y | |
253 | relative_path /foo/a/b "<empty>" /foo/a/b | |
254 | relative_path /foo/a/b "<null>" /foo/a/b | |
255 | relative_path foo/a/b/c/ foo/a/b/ c/ | |
256 | relative_path foo/a/b/c/ foo/a/b c/ | |
257 | relative_path foo/a/b//c foo/a//b c | |
258 | relative_path foo/a/b/ foo/a/b/ ./ | |
259 | relative_path foo/a/b/ foo/a/b ./ | |
260 | relative_path foo/a foo/a/b ../ | |
261 | relative_path foo/x/y foo/a/b ../../x/y | |
262 | relative_path foo/a/c foo/a/b ../c | |
7fbd4221 JX |
263 | relative_path foo/a/b /foo/x/y foo/a/b |
264 | relative_path /foo/a/b foo/x/y /foo/a/b | |
265 | relative_path d:/a/b D:/a/c ../b MINGW | |
266 | relative_path C:/a/b D:/a/c C:/a/b MINGW | |
daf19a80 JX |
267 | relative_path foo/a/b "<empty>" foo/a/b |
268 | relative_path foo/a/b "<null>" foo/a/b | |
269 | relative_path "<empty>" /foo/a/b ./ | |
270 | relative_path "<empty>" "<empty>" ./ | |
271 | relative_path "<empty>" "<null>" ./ | |
272 | relative_path "<null>" "<empty>" ./ | |
273 | relative_path "<null>" "<null>" ./ | |
274 | relative_path "<null>" /foo/a/b ./ | |
203439b2 | 275 | |
557bd833 NTND |
276 | test_git_path A=B info/grafts .git/info/grafts |
277 | test_git_path GIT_GRAFT_FILE=foo info/grafts foo | |
278 | test_git_path GIT_GRAFT_FILE=foo info/////grafts foo | |
279 | test_git_path GIT_INDEX_FILE=foo index foo | |
280 | test_git_path GIT_INDEX_FILE=foo index/foo .git/index/foo | |
281 | test_git_path GIT_INDEX_FILE=foo index2 .git/index2 | |
282 | test_expect_success 'setup fake objects directory foo' 'mkdir foo' | |
283 | test_git_path GIT_OBJECT_DIRECTORY=foo objects foo | |
284 | test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo | |
285 | test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2 | |
c7b3a3d2 NTND |
286 | test_expect_success 'setup common repository' 'git --git-dir=bar init' |
287 | test_git_path GIT_COMMON_DIR=bar index .git/index | |
288 | test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD | |
289 | test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD | |
ce414b33 DT |
290 | test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo |
291 | test_git_path GIT_COMMON_DIR=bar logs/refs/bisec/foo bar/logs/refs/bisec/foo | |
292 | test_git_path GIT_COMMON_DIR=bar logs/refs/bisec bar/logs/refs/bisec | |
293 | test_git_path GIT_COMMON_DIR=bar logs/refs/bisectfoo bar/logs/refs/bisectfoo | |
c7b3a3d2 NTND |
294 | test_git_path GIT_COMMON_DIR=bar objects bar/objects |
295 | test_git_path GIT_COMMON_DIR=bar objects/bar bar/objects/bar | |
296 | test_git_path GIT_COMMON_DIR=bar info/exclude bar/info/exclude | |
297 | test_git_path GIT_COMMON_DIR=bar info/grafts bar/info/grafts | |
6cfbdcb2 | 298 | test_git_path GIT_COMMON_DIR=bar info/sparse-checkout .git/info/sparse-checkout |
4e09cf2a | 299 | test_git_path GIT_COMMON_DIR=bar info//sparse-checkout .git/info//sparse-checkout |
c7b3a3d2 NTND |
300 | test_git_path GIT_COMMON_DIR=bar remotes/bar bar/remotes/bar |
301 | test_git_path GIT_COMMON_DIR=bar branches/bar bar/branches/bar | |
302 | test_git_path GIT_COMMON_DIR=bar logs/refs/heads/master bar/logs/refs/heads/master | |
303 | test_git_path GIT_COMMON_DIR=bar refs/heads/master bar/refs/heads/master | |
ce414b33 | 304 | test_git_path GIT_COMMON_DIR=bar refs/bisect/foo .git/refs/bisect/foo |
c7b3a3d2 NTND |
305 | test_git_path GIT_COMMON_DIR=bar hooks/me bar/hooks/me |
306 | test_git_path GIT_COMMON_DIR=bar config bar/config | |
307 | test_git_path GIT_COMMON_DIR=bar packed-refs bar/packed-refs | |
308 | test_git_path GIT_COMMON_DIR=bar shallow bar/shallow | |
8aff1a9c NTND |
309 | test_git_path GIT_COMMON_DIR=bar common bar/common |
310 | test_git_path GIT_COMMON_DIR=bar common/file bar/common/file | |
557bd833 | 311 | |
77b63ac3 JS |
312 | # In the tests below, $(pwd) must be used because it is a native path on |
313 | # Windows and avoids MSYS's path mangling (which simplifies "foo/../bar" and | |
314 | # strips the dot from trailing "/."). | |
63e95beb SB |
315 | |
316 | test_submodule_relative_url "../" "../foo" "../submodule" "../../submodule" | |
317 | test_submodule_relative_url "../" "../foo/bar" "../submodule" "../../foo/submodule" | |
318 | test_submodule_relative_url "../" "../foo/submodule" "../submodule" "../../foo/submodule" | |
319 | test_submodule_relative_url "../" "./foo" "../submodule" "../submodule" | |
320 | test_submodule_relative_url "../" "./foo/bar" "../submodule" "../foo/submodule" | |
321 | test_submodule_relative_url "../../../" "../foo/bar" "../sub/a/b/c" "../../../../foo/sub/a/b/c" | |
77b63ac3 | 322 | test_submodule_relative_url "../" "$(pwd)/addtest" "../repo" "$(pwd)/repo" |
63e95beb SB |
323 | test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule" |
324 | test_submodule_relative_url "../" "foo" "../submodule" "../submodule" | |
325 | ||
326 | test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c" "../foo/sub/a/b/c" | |
3389e78e | 327 | test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c/" "../foo/sub/a/b/c" |
08788504 | 328 | test_submodule_relative_url "(null)" "../foo/bar/" "../sub/a/b/c" "../foo/sub/a/b/c" |
63e95beb SB |
329 | test_submodule_relative_url "(null)" "../foo/bar" "../submodule" "../foo/submodule" |
330 | test_submodule_relative_url "(null)" "../foo/submodule" "../submodule" "../foo/submodule" | |
331 | test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule" | |
332 | test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule" | |
333 | test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule" | |
334 | test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo" | |
2711b1ad ÆAB |
335 | test_submodule_relative_url "(null)" "//somewhere else/repo" "../../subrepo" "//subrepo" |
336 | test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../subrepo" "/subrepo" | |
337 | test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../../subrepo" "subrepo" | |
77b63ac3 JS |
338 | test_submodule_relative_url "(null)" "$(pwd)/subsuper_update_r" "../subsubsuper_update_r" "$(pwd)/subsubsuper_update_r" |
339 | test_submodule_relative_url "(null)" "$(pwd)/super_update_r2" "../subsuper_update_r" "$(pwd)/subsuper_update_r" | |
340 | test_submodule_relative_url "(null)" "$(pwd)/." "../." "$(pwd)/." | |
341 | test_submodule_relative_url "(null)" "$(pwd)" "./." "$(pwd)/." | |
342 | test_submodule_relative_url "(null)" "$(pwd)/addtest" "../repo" "$(pwd)/repo" | |
343 | test_submodule_relative_url "(null)" "$(pwd)" "./å äö" "$(pwd)/å äö" | |
344 | test_submodule_relative_url "(null)" "$(pwd)/." "../submodule" "$(pwd)/submodule" | |
345 | test_submodule_relative_url "(null)" "$(pwd)/submodule" "../submodule" "$(pwd)/submodule" | |
346 | test_submodule_relative_url "(null)" "$(pwd)/home2/../remote" "../bundle1" "$(pwd)/home2/../bundle1" | |
347 | test_submodule_relative_url "(null)" "$(pwd)/submodule_update_repo" "./." "$(pwd)/submodule_update_repo/." | |
63e95beb SB |
348 | test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tmp/subrepo" |
349 | test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule" | |
350 | test_submodule_relative_url "(null)" "foo" "../submodule" "submodule" | |
351 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../subrepo" "helper:://hostname/subrepo" | |
2711b1ad ÆAB |
352 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../subrepo" "helper:://subrepo" |
353 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../subrepo" "helper::/subrepo" | |
354 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../subrepo" "helper::subrepo" | |
355 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../subrepo" "helper:subrepo" | |
356 | test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../../subrepo" ".:subrepo" | |
63e95beb | 357 | test_submodule_relative_url "(null)" "ssh://hostname/repo" "../subrepo" "ssh://hostname/subrepo" |
2711b1ad ÆAB |
358 | test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../subrepo" "ssh://subrepo" |
359 | test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../subrepo" "ssh:/subrepo" | |
360 | test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../subrepo" "ssh:subrepo" | |
361 | test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../../subrepo" ".:subrepo" | |
63e95beb SB |
362 | test_submodule_relative_url "(null)" "ssh://hostname:22/repo" "../subrepo" "ssh://hostname:22/subrepo" |
363 | test_submodule_relative_url "(null)" "user@host:path/to/repo" "../subrepo" "user@host:path/to/subrepo" | |
364 | test_submodule_relative_url "(null)" "user@host:repo" "../subrepo" "user@host:subrepo" | |
2711b1ad | 365 | test_submodule_relative_url "(null)" "user@host:repo" "../../subrepo" ".:subrepo" |
63e95beb | 366 | |
dc2d9ba3 | 367 | test_expect_success 'match .gitmodules' ' |
7913f53b | 368 | test-tool path-utils is_dotgitmodules \ |
dc2d9ba3 JS |
369 | .gitmodules \ |
370 | \ | |
371 | .git${u200c}modules \ | |
372 | \ | |
373 | .Gitmodules \ | |
374 | .gitmoduleS \ | |
375 | \ | |
376 | ".gitmodules " \ | |
377 | ".gitmodules." \ | |
378 | ".gitmodules " \ | |
379 | ".gitmodules. " \ | |
380 | ".gitmodules ." \ | |
381 | ".gitmodules.." \ | |
382 | ".gitmodules " \ | |
383 | ".gitmodules. " \ | |
384 | ".gitmodules . " \ | |
385 | ".gitmodules ." \ | |
386 | \ | |
387 | ".Gitmodules " \ | |
388 | ".Gitmodules." \ | |
389 | ".Gitmodules " \ | |
390 | ".Gitmodules. " \ | |
391 | ".Gitmodules ." \ | |
392 | ".Gitmodules.." \ | |
393 | ".Gitmodules " \ | |
394 | ".Gitmodules. " \ | |
395 | ".Gitmodules . " \ | |
396 | ".Gitmodules ." \ | |
397 | \ | |
398 | GITMOD~1 \ | |
399 | gitmod~1 \ | |
400 | GITMOD~2 \ | |
401 | gitmod~3 \ | |
402 | GITMOD~4 \ | |
403 | \ | |
404 | "GITMOD~1 " \ | |
405 | "gitmod~2." \ | |
406 | "GITMOD~3 " \ | |
407 | "gitmod~4. " \ | |
408 | "GITMOD~1 ." \ | |
409 | "gitmod~2 " \ | |
410 | "GITMOD~3. " \ | |
411 | "gitmod~4 . " \ | |
412 | \ | |
413 | GI7EBA~1 \ | |
414 | gi7eba~9 \ | |
415 | \ | |
416 | GI7EB~10 \ | |
417 | GI7EB~11 \ | |
418 | GI7EB~99 \ | |
419 | GI7EB~10 \ | |
420 | GI7E~100 \ | |
421 | GI7E~101 \ | |
422 | GI7E~999 \ | |
423 | ~1000000 \ | |
424 | ~9999999 \ | |
425 | \ | |
426 | --not \ | |
427 | ".gitmodules x" \ | |
428 | ".gitmodules .x" \ | |
429 | \ | |
430 | " .gitmodules" \ | |
431 | \ | |
432 | ..gitmodules \ | |
433 | \ | |
434 | gitmodules \ | |
435 | \ | |
436 | .gitmodule \ | |
437 | \ | |
438 | ".gitmodules x " \ | |
439 | ".gitmodules .x" \ | |
440 | \ | |
441 | GI7EBA~ \ | |
442 | GI7EBA~0 \ | |
443 | GI7EBA~~1 \ | |
444 | GI7EBA~X \ | |
445 | Gx7EBA~1 \ | |
446 | GI7EBX~1 \ | |
447 | \ | |
448 | GI7EB~1 \ | |
449 | GI7EB~01 \ | |
450 | GI7EB~1X | |
451 | ' | |
452 | ||
ae299be0 | 453 | test_done |