3 test_description
='handling of alternates in environment variables'
11 echo "$obj $expect" >&6
12 done 5>input
6>expect
&&
13 GIT_ALTERNATE_OBJECT_DIRECTORIES
=$alt \
14 git
"$@" cat-file
--batch-check='%(objectname) %(objecttype)' \
16 test_cmp expect actual
19 test_expect_success
'create alternate repositories' '
20 git init --bare one.git &&
21 one=$(echo one | git -C one.git hash-object -w --stdin) &&
22 git init --bare two.git &&
23 two=$(echo two | git -C two.git hash-object -w --stdin)
26 test_expect_success
'objects inaccessible without alternates' '
33 test_expect_success
'access alternate via absolute path' '
34 check_obj "$PWD/one.git/objects" <<-EOF
40 test_expect_success
'access multiple alternates' '
41 check_obj "$PWD/one.git/objects:$PWD/two.git/objects" <<-EOF
47 # bare paths are relative from $GIT_DIR
48 test_expect_success
'access alternate via relative path (bare)' '
49 git init --bare bare.git &&
50 check_obj "../one.git/objects" -C bare.git <<-EOF
55 # non-bare paths are relative to top of worktree
56 test_expect_success
'access alternate via relative path (worktree)' '
58 check_obj "../one.git/objects" -C worktree <<-EOF
63 # path is computed after moving to top-level of worktree
64 test_expect_success
'access alternate via relative path (subdir)' '
66 check_obj "one.git/objects" -C subdir <<-EOF
71 # set variables outside test to avoid quote insanity; the \057 is '/',
72 # which doesn't need quoting, but just confirms that de-quoting
74 quoted
='"one.git\057objects"'
75 unquoted
='two.git/objects'
76 test_expect_success
'mix of quoted and unquoted alternates' '
77 check_obj "$quoted:$unquoted" <<-EOF
83 test_expect_success
!MINGW
'broken quoting falls back to interpreting raw' '
84 mv one.git \"one.git &&
85 check_obj \"one.git/objects <<-EOF