upload-pack: fix a memory leak in create_pack_file()
[git/debian.git] / t / t0060-path-utils.sh
blob1f2007e62b753c39992f681a711e4439e6577e3b
1 #!/bin/sh
3 # Copyright (c) 2008 David Reiss
6 test_description='Test various path utilities'
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 norm_path() {
12 expected=$(test-tool path-utils print_path "$2")
13 test_expect_success $3 "normalize path: $1 => $2" \
14 "test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
17 relative_path() {
18 expected=$(test-tool path-utils print_path "$3")
19 test_expect_success $4 "relative path: $1 $2 => $3" \
20 "test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
23 test_submodule_relative_url() {
24 test_expect_success "test_submodule_relative_url: $1 $2 $3 => $4" "
25 actual=\$(git submodule--helper resolve-relative-url-test '$1' '$2' '$3') &&
26 test \"\$actual\" = '$4'
30 test_git_path() {
31 test_expect_success "git-path $1 $2 => $3" "
32 $1 git rev-parse --git-path $2 >actual &&
33 echo $3 >expect &&
34 test_cmp expect actual
38 # On Windows, we are using MSYS's bash, which mangles the paths.
39 # Absolute paths are anchored at the MSYS installation directory,
40 # which means that the path / accounts for this many characters:
41 rootoff=$(test-tool path-utils normalize_path_copy / | wc -c)
42 # Account for the trailing LF:
43 if test $rootoff = 2; then
44 rootoff= # we are on Unix
45 else
46 rootoff=$(($rootoff-1))
47 # In MSYS2, the root directory "/" is translated into a Windows
48 # directory *with* trailing slash. Let's test for that and adjust
49 # our expected longest ancestor length accordingly.
50 case "$(test-tool path-utils print_path /)" in
51 */) rootslash=1;;
52 *) rootslash=0;;
53 esac
56 ancestor() {
57 # We do some math with the expected ancestor length.
58 expected=$3
59 case "$rootoff,$expected,$2" in
60 *,*,//*) ;; # leave UNC paths alone
61 [0-9]*,[0-9]*,/*)
62 # On Windows, expect MSYS2 pseudo root translation for
63 # Unix-style absolute paths
64 expected=$(($expected-$rootslash+$rootoff))
66 esac
67 test_expect_success $4 "longest ancestor: $1 $2 => $expected" \
68 "actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
69 test \"\$actual\" = '$expected'"
72 # Some absolute path tests should be skipped on Windows due to path mangling
73 # on POSIX-style absolute paths
74 case $(uname -s) in
75 *MINGW*)
77 *CYGWIN*)
80 test_set_prereq POSIX
82 esac
84 test_expect_success basename 'test-tool path-utils basename'
85 test_expect_success dirname 'test-tool path-utils dirname'
87 norm_path "" ""
88 norm_path . ""
89 norm_path ./ ""
90 norm_path ./. ""
91 norm_path ./.. ++failed++
92 norm_path ../. ++failed++
93 norm_path ./../.// ++failed++
94 norm_path dir/.. ""
95 norm_path dir/sub/../.. ""
96 norm_path dir/sub/../../.. ++failed++
97 norm_path dir dir
98 norm_path dir// dir/
99 norm_path ./dir dir
100 norm_path dir/. dir/
101 norm_path dir///./ dir/
102 norm_path dir//sub/.. dir/
103 norm_path dir/sub/../ dir/
104 norm_path dir/sub/../. dir/
105 norm_path dir/s1/../s2/ dir/s2/
106 norm_path d1/s1///s2/..//../s3/ d1/s3/
107 norm_path d1/s1//../s2/../../d2 d2
108 norm_path d1/.../d2 d1/.../d2
109 norm_path d1/..././../d2 d1/d2
111 norm_path / /
112 norm_path // / POSIX
113 norm_path /// / POSIX
114 norm_path /. /
115 norm_path /./ / POSIX
116 norm_path /./.. ++failed++ POSIX
117 norm_path /../. ++failed++
118 norm_path /./../.// ++failed++ POSIX
119 norm_path /dir/.. / POSIX
120 norm_path /dir/sub/../.. / POSIX
121 norm_path /dir/sub/../../.. ++failed++ POSIX
122 norm_path /dir /dir
123 norm_path /dir// /dir/
124 norm_path /./dir /dir
125 norm_path /dir/. /dir/
126 norm_path /dir///./ /dir/
127 norm_path /dir//sub/.. /dir/
128 norm_path /dir/sub/../ /dir/
129 norm_path //dir/sub/../. /dir/ POSIX
130 norm_path /dir/s1/../s2/ /dir/s2/
131 norm_path /d1/s1///s2/..//../s3/ /d1/s3/
132 norm_path /d1/s1//../s2/../../d2 /d2
133 norm_path /d1/.../d2 /d1/.../d2
134 norm_path /d1/..././../d2 /d1/d2
136 ancestor / / -1
137 ancestor /foo / 0
138 ancestor /foo /fo -1
139 ancestor /foo /foo -1
140 ancestor /foo /bar -1
141 ancestor /foo /foo/bar -1
142 ancestor /foo /foo:/bar -1
143 ancestor /foo /:/foo:/bar 0
144 ancestor /foo /foo:/:/bar 0
145 ancestor /foo /:/bar:/foo 0
146 ancestor /foo/bar / 0
147 ancestor /foo/bar /fo -1
148 ancestor /foo/bar /foo 4
149 ancestor /foo/bar /foo/ba -1
150 ancestor /foo/bar /:/fo 0
151 ancestor /foo/bar /foo:/foo/ba 4
152 ancestor /foo/bar /bar -1
153 ancestor /foo/bar /fo -1
154 ancestor /foo/bar /foo:/bar 4
155 ancestor /foo/bar /:/foo:/bar 4
156 ancestor /foo/bar /foo:/:/bar 4
157 ancestor /foo/bar /:/bar:/fo 0
158 ancestor /foo/bar /:/bar 0
159 ancestor /foo/bar /foo 4
160 ancestor /foo/bar /foo:/bar 4
161 ancestor /foo/bar /bar -1
163 # Windows-specific: DOS drives, network shares
164 ancestor C:/Users/me C:/ 2 MINGW
165 ancestor D:/Users/me C:/ -1 MINGW
166 ancestor //server/share/my-directory //server/share/ 14 MINGW
168 test_expect_success 'strip_path_suffix' '
169 test c:/msysgit = $(test-tool path-utils strip_path_suffix \
170 c:/msysgit/libexec//git-core libexec/git-core)
173 test_expect_success 'absolute path rejects the empty string' '
174 test_must_fail test-tool path-utils absolute_path ""
177 test_expect_success MINGW '<drive-letter>:\\abc is an absolute path' '
178 for letter in : \" C Z 1 ä
180 path=$letter:\\abc &&
181 absolute="$(test-tool path-utils absolute_path "$path")" &&
182 test "$path" = "$absolute" || return 1
183 done
186 test_expect_success 'real path rejects the empty string' '
187 test_must_fail test-tool path-utils real_path ""
190 test_expect_success POSIX 'real path works on absolute paths 1' '
191 nopath="hopefully-absent-path" &&
192 test "/" = "$(test-tool path-utils real_path "/")" &&
193 test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
196 test_expect_success 'real path works on absolute paths 2' '
197 nopath="hopefully-absent-path" &&
198 # Find an existing top-level directory for the remaining tests:
199 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
200 test "$d" = "$(test-tool path-utils real_path "$d")" &&
201 test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
204 test_expect_success POSIX 'real path removes extra leading slashes' '
205 nopath="hopefully-absent-path" &&
206 test "/" = "$(test-tool path-utils real_path "///")" &&
207 test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
208 # Find an existing top-level directory for the remaining tests:
209 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
210 test "$d" = "$(test-tool path-utils real_path "//$d")" &&
211 test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
214 test_expect_success 'real path removes other extra slashes' '
215 nopath="hopefully-absent-path" &&
216 # Find an existing top-level directory for the remaining tests:
217 d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
218 test "$d" = "$(test-tool path-utils real_path "$d///")" &&
219 test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
222 test_expect_success SYMLINKS 'real path works on symlinks' '
223 mkdir first &&
224 ln -s ../.git first/.git &&
225 mkdir second &&
226 ln -s ../first second/other &&
227 mkdir third &&
228 dir="$(cd .git && pwd -P)" &&
229 dir2=third/../second/other/.git &&
230 test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
231 file="$dir"/index &&
232 test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
233 basename=blub &&
234 test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
235 ln -s ../first/file .git/syml &&
236 sym="$(cd first && pwd -P)"/file &&
237 test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
240 test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
241 ln -s target symlink &&
242 test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
245 test_expect_success 'prefix_path works with only absolute path to work tree' '
246 echo "" >expected &&
247 test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
248 test_cmp expected actual
251 test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
252 test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
255 test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' '
256 git init repo &&
257 ln -s repo repolink &&
258 test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
261 relative_path /foo/a/b/c/ /foo/a/b/ c/
262 relative_path /foo/a/b/c/ /foo/a/b c/
263 relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX
264 relative_path /foo/a/b /foo/a/b ./
265 relative_path /foo/a/b/ /foo/a/b ./
266 relative_path /foo/a /foo/a/b ../
267 relative_path / /foo/a/b/ ../../../
268 relative_path /foo/a/c /foo/a/b/ ../c
269 relative_path /foo/a/c /foo/a/b ../c
270 relative_path /foo/x/y /foo/a/b/ ../../x/y
271 relative_path /foo/a/b "<empty>" /foo/a/b
272 relative_path /foo/a/b "<null>" /foo/a/b
273 relative_path foo/a/b/c/ foo/a/b/ c/
274 relative_path foo/a/b/c/ foo/a/b c/
275 relative_path foo/a/b//c foo/a//b c
276 relative_path foo/a/b/ foo/a/b/ ./
277 relative_path foo/a/b/ foo/a/b ./
278 relative_path foo/a foo/a/b ../
279 relative_path foo/x/y foo/a/b ../../x/y
280 relative_path foo/a/c foo/a/b ../c
281 relative_path foo/a/b /foo/x/y foo/a/b
282 relative_path /foo/a/b foo/x/y /foo/a/b
283 relative_path d:/a/b D:/a/c ../b MINGW
284 relative_path C:/a/b D:/a/c C:/a/b MINGW
285 relative_path foo/a/b "<empty>" foo/a/b
286 relative_path foo/a/b "<null>" foo/a/b
287 relative_path "<empty>" /foo/a/b ./
288 relative_path "<empty>" "<empty>" ./
289 relative_path "<empty>" "<null>" ./
290 relative_path "<null>" "<empty>" ./
291 relative_path "<null>" "<null>" ./
292 relative_path "<null>" /foo/a/b ./
294 test_git_path A=B info/grafts .git/info/grafts
295 test_git_path GIT_GRAFT_FILE=foo info/grafts foo
296 test_git_path GIT_GRAFT_FILE=foo info/////grafts foo
297 test_git_path GIT_INDEX_FILE=foo index foo
298 test_git_path GIT_INDEX_FILE=foo index/foo .git/index/foo
299 test_git_path GIT_INDEX_FILE=foo index2 .git/index2
300 test_expect_success 'setup fake objects directory foo' 'mkdir foo'
301 test_git_path GIT_OBJECT_DIRECTORY=foo objects foo
302 test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo
303 test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2
304 test_expect_success 'setup common repository' 'git --git-dir=bar init'
305 test_git_path GIT_COMMON_DIR=bar index .git/index
306 test_git_path GIT_COMMON_DIR=bar index.lock .git/index.lock
307 test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD
308 test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD
309 test_git_path GIT_COMMON_DIR=bar logs/HEAD.lock .git/logs/HEAD.lock
310 test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo
311 test_git_path GIT_COMMON_DIR=bar logs/refs bar/logs/refs
312 test_git_path GIT_COMMON_DIR=bar logs/refs/ bar/logs/refs/
313 test_git_path GIT_COMMON_DIR=bar logs/refs/bisec/foo bar/logs/refs/bisec/foo
314 test_git_path GIT_COMMON_DIR=bar logs/refs/bisec bar/logs/refs/bisec
315 test_git_path GIT_COMMON_DIR=bar logs/refs/bisectfoo bar/logs/refs/bisectfoo
316 test_git_path GIT_COMMON_DIR=bar objects bar/objects
317 test_git_path GIT_COMMON_DIR=bar objects/bar bar/objects/bar
318 test_git_path GIT_COMMON_DIR=bar info/exclude bar/info/exclude
319 test_git_path GIT_COMMON_DIR=bar info/grafts bar/info/grafts
320 test_git_path GIT_COMMON_DIR=bar info/sparse-checkout .git/info/sparse-checkout
321 test_git_path GIT_COMMON_DIR=bar info//sparse-checkout .git/info//sparse-checkout
322 test_git_path GIT_COMMON_DIR=bar remotes/bar bar/remotes/bar
323 test_git_path GIT_COMMON_DIR=bar branches/bar bar/branches/bar
324 test_git_path GIT_COMMON_DIR=bar logs/refs/heads/main bar/logs/refs/heads/main
325 test_git_path GIT_COMMON_DIR=bar refs/heads/main bar/refs/heads/main
326 test_git_path GIT_COMMON_DIR=bar refs/bisect/foo .git/refs/bisect/foo
327 test_git_path GIT_COMMON_DIR=bar hooks/me bar/hooks/me
328 test_git_path GIT_COMMON_DIR=bar config bar/config
329 test_git_path GIT_COMMON_DIR=bar packed-refs bar/packed-refs
330 test_git_path GIT_COMMON_DIR=bar shallow bar/shallow
331 test_git_path GIT_COMMON_DIR=bar common bar/common
332 test_git_path GIT_COMMON_DIR=bar common/file bar/common/file
334 # In the tests below, $(pwd) must be used because it is a native path on
335 # Windows and avoids MSYS's path mangling (which simplifies "foo/../bar" and
336 # strips the dot from trailing "/.").
338 test_submodule_relative_url "../" "../foo" "../submodule" "../../submodule"
339 test_submodule_relative_url "../" "../foo/bar" "../submodule" "../../foo/submodule"
340 test_submodule_relative_url "../" "../foo/submodule" "../submodule" "../../foo/submodule"
341 test_submodule_relative_url "../" "./foo" "../submodule" "../submodule"
342 test_submodule_relative_url "../" "./foo/bar" "../submodule" "../foo/submodule"
343 test_submodule_relative_url "../../../" "../foo/bar" "../sub/a/b/c" "../../../../foo/sub/a/b/c"
344 test_submodule_relative_url "../" "$(pwd)/addtest" "../repo" "$(pwd)/repo"
345 test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule"
346 test_submodule_relative_url "../" "foo" "../submodule" "../submodule"
348 test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c" "../foo/sub/a/b/c"
349 test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c/" "../foo/sub/a/b/c"
350 test_submodule_relative_url "(null)" "../foo/bar/" "../sub/a/b/c" "../foo/sub/a/b/c"
351 test_submodule_relative_url "(null)" "../foo/bar" "../submodule" "../foo/submodule"
352 test_submodule_relative_url "(null)" "../foo/submodule" "../submodule" "../foo/submodule"
353 test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule"
354 test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule"
355 test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule"
356 test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo"
357 test_submodule_relative_url "(null)" "//somewhere else/repo" "../../subrepo" "//subrepo"
358 test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../subrepo" "/subrepo"
359 test_submodule_relative_url "(null)" "//somewhere else/repo" "../../../../subrepo" "subrepo"
360 test_submodule_relative_url "(null)" "$(pwd)/subsuper_update_r" "../subsubsuper_update_r" "$(pwd)/subsubsuper_update_r"
361 test_submodule_relative_url "(null)" "$(pwd)/super_update_r2" "../subsuper_update_r" "$(pwd)/subsuper_update_r"
362 test_submodule_relative_url "(null)" "$(pwd)/." "../." "$(pwd)/."
363 test_submodule_relative_url "(null)" "$(pwd)" "./." "$(pwd)/."
364 test_submodule_relative_url "(null)" "$(pwd)/addtest" "../repo" "$(pwd)/repo"
365 test_submodule_relative_url "(null)" "$(pwd)" "./å äö" "$(pwd)/å äö"
366 test_submodule_relative_url "(null)" "$(pwd)/." "../submodule" "$(pwd)/submodule"
367 test_submodule_relative_url "(null)" "$(pwd)/submodule" "../submodule" "$(pwd)/submodule"
368 test_submodule_relative_url "(null)" "$(pwd)/home2/../remote" "../bundle1" "$(pwd)/home2/../bundle1"
369 test_submodule_relative_url "(null)" "$(pwd)/submodule_update_repo" "./." "$(pwd)/submodule_update_repo/."
370 test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tmp/subrepo"
371 test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule"
372 test_submodule_relative_url "(null)" "foo" "../submodule" "submodule"
373 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../subrepo" "helper:://hostname/subrepo"
374 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../subrepo" "helper:://subrepo"
375 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../subrepo" "helper::/subrepo"
376 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../subrepo" "helper::subrepo"
377 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../subrepo" "helper:subrepo"
378 test_submodule_relative_url "(null)" "helper:://hostname/repo" "../../../../../../subrepo" ".:subrepo"
379 test_submodule_relative_url "(null)" "ssh://hostname/repo" "../subrepo" "ssh://hostname/subrepo"
380 test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../subrepo" "ssh://subrepo"
381 test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../subrepo" "ssh:/subrepo"
382 test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../subrepo" "ssh:subrepo"
383 test_submodule_relative_url "(null)" "ssh://hostname/repo" "../../../../../subrepo" ".:subrepo"
384 test_submodule_relative_url "(null)" "ssh://hostname:22/repo" "../subrepo" "ssh://hostname:22/subrepo"
385 test_submodule_relative_url "(null)" "user@host:path/to/repo" "../subrepo" "user@host:path/to/subrepo"
386 test_submodule_relative_url "(null)" "user@host:repo" "../subrepo" "user@host:subrepo"
387 test_submodule_relative_url "(null)" "user@host:repo" "../../subrepo" ".:subrepo"
389 test_expect_success 'match .gitmodules' '
390 test-tool path-utils is_dotgitmodules \
391 .gitmodules \
393 .git${u200c}modules \
395 .Gitmodules \
396 .gitmoduleS \
398 ".gitmodules " \
399 ".gitmodules." \
400 ".gitmodules " \
401 ".gitmodules. " \
402 ".gitmodules ." \
403 ".gitmodules.." \
404 ".gitmodules " \
405 ".gitmodules. " \
406 ".gitmodules . " \
407 ".gitmodules ." \
409 ".Gitmodules " \
410 ".Gitmodules." \
411 ".Gitmodules " \
412 ".Gitmodules. " \
413 ".Gitmodules ." \
414 ".Gitmodules.." \
415 ".Gitmodules " \
416 ".Gitmodules. " \
417 ".Gitmodules . " \
418 ".Gitmodules ." \
420 GITMOD~1 \
421 gitmod~1 \
422 GITMOD~2 \
423 gitmod~3 \
424 GITMOD~4 \
426 "GITMOD~1 " \
427 "gitmod~2." \
428 "GITMOD~3 " \
429 "gitmod~4. " \
430 "GITMOD~1 ." \
431 "gitmod~2 " \
432 "GITMOD~3. " \
433 "gitmod~4 . " \
435 GI7EBA~1 \
436 gi7eba~9 \
438 GI7EB~10 \
439 GI7EB~11 \
440 GI7EB~99 \
441 GI7EB~10 \
442 GI7E~100 \
443 GI7E~101 \
444 GI7E~999 \
445 ~1000000 \
446 ~9999999 \
448 .gitmodules:\$DATA \
449 "gitmod~4 . :\$DATA" \
451 --not \
452 ".gitmodules x" \
453 ".gitmodules .x" \
455 " .gitmodules" \
457 ..gitmodules \
459 gitmodules \
461 .gitmodule \
463 ".gitmodules x " \
464 ".gitmodules .x" \
466 GI7EBA~ \
467 GI7EBA~0 \
468 GI7EBA~~1 \
469 GI7EBA~X \
470 Gx7EBA~1 \
471 GI7EBX~1 \
473 GI7EB~1 \
474 GI7EB~01 \
475 GI7EB~1X \
477 .gitmodules,:\$DATA
480 test_expect_success 'match .gitattributes' '
481 test-tool path-utils is_dotgitattributes \
482 .gitattributes \
483 .git${u200c}attributes \
484 .Gitattributes \
485 .gitattributeS \
486 GITATT~1 \
487 GI7D29~1
490 test_expect_success 'match .gitignore' '
491 test-tool path-utils is_dotgitignore \
492 .gitignore \
493 .git${u200c}ignore \
494 .Gitignore \
495 .gitignorE \
496 GITIGN~1 \
497 GI250A~1
500 test_expect_success 'match .mailmap' '
501 test-tool path-utils is_dotmailmap \
502 .mailmap \
503 .mail${u200c}map \
504 .Mailmap \
505 .mailmaP \
506 MAILMA~1 \
507 MABA30~1
510 test_expect_success MINGW 'is_valid_path() on Windows' '
511 test-tool path-utils is_valid_path \
512 win32 \
513 "win32 x" \
514 ../hello.txt \
515 C:\\git \
516 comm \
517 conout.c \
518 com0.c \
519 lptN \
521 --not \
522 "win32 " \
523 "win32 /x " \
524 "win32." \
525 "win32 . ." \
526 .../hello.txt \
527 colon:test \
528 "AUX.c" \
529 "abc/conOut\$ .xyz/test" \
530 lpt8 \
531 com9.c \
532 "lpt*" \
533 Nul \
534 "PRN./abc"
537 test_lazy_prereq RUNTIME_PREFIX '
538 test true = "$RUNTIME_PREFIX"
541 test_lazy_prereq CAN_EXEC_IN_PWD '
542 cp "$GIT_EXEC_PATH"/git$X ./ &&
543 ./git rev-parse
546 test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX works' '
547 mkdir -p pretend/bin pretend/libexec/git-core &&
548 echo "echo HERE" | write_script pretend/libexec/git-core/git-here &&
549 cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
550 GIT_EXEC_PATH= ./pretend/bin/git here >actual &&
551 echo HERE >expect &&
552 test_cmp expect actual'
554 test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
555 mkdir -p pretend/bin &&
556 cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
557 git config yes.path "%(prefix)/yes" &&
558 GIT_EXEC_PATH= ./pretend/bin/git config --path yes.path >actual &&
559 echo "$(pwd)/pretend/yes" >expect &&
560 test_cmp expect actual
563 test_done