3 test_description
='handling of alternates in environment variables'
5 TEST_PASSES_SANITIZE_LEAK
=true
13 echo "$obj $expect" >&6
14 done 5>input
6>expect
&&
15 GIT_ALTERNATE_OBJECT_DIRECTORIES
=$alt \
16 git
"$@" cat-file
--batch-check='%(objectname) %(objecttype)' \
18 test_cmp expect actual
21 test_expect_success
'create alternate repositories' '
22 git init --bare one.git &&
23 one=$(echo one | git -C one.git hash-object -w --stdin) &&
24 git init --bare two.git &&
25 two=$(echo two | git -C two.git hash-object -w --stdin)
28 test_expect_success
'objects inaccessible without alternates' '
35 test_expect_success
'access alternate via absolute path' '
36 check_obj "$PWD/one.git/objects" <<-EOF
42 test_expect_success
'access multiple alternates' '
43 check_obj "$PWD/one.git/objects:$PWD/two.git/objects" <<-EOF
49 # bare paths are relative from $GIT_DIR
50 test_expect_success
'access alternate via relative path (bare)' '
51 git init --bare bare.git &&
52 check_obj "../one.git/objects" -C bare.git <<-EOF
57 # non-bare paths are relative to top of worktree
58 test_expect_success
'access alternate via relative path (worktree)' '
60 check_obj "../one.git/objects" -C worktree <<-EOF
65 # path is computed after moving to top-level of worktree
66 test_expect_success
'access alternate via relative path (subdir)' '
68 check_obj "one.git/objects" -C subdir <<-EOF
73 # set variables outside test to avoid quote insanity; the \057 is '/',
74 # which doesn't need quoting, but just confirms that de-quoting
76 quoted
='"one.git\057objects"'
77 unquoted
='two.git/objects'
78 test_expect_success
'mix of quoted and unquoted alternates' '
79 check_obj "$quoted:$unquoted" <<-EOF
85 test_expect_success
!MINGW
'broken quoting falls back to interpreting raw' '
86 mv one.git \"one.git &&
87 check_obj \"one.git/objects <<-EOF