3 test_description
='cd_to_toplevel'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 EXEC_PATH
="$(git --exec-path)"
9 test_have_prereq
!MINGW ||
12 EXEC_PATH
="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
16 test_cd_to_toplevel
() {
17 test_expect_success
$3 "$2" '
20 PATH="$EXEC_PATH:$PATH" &&
23 [ "$(pwd -P)" = "$TOPLEVEL" ]
28 TOPLEVEL
="$(pwd -P)/repo"
33 test_cd_to_toplevel repo
'at physical root'
35 test_cd_to_toplevel repo
/sub
/dir
'at physical subdir'
37 ln -s repo symrepo
2>/dev
/null
38 test_cd_to_toplevel symrepo
'at symbolic root' SYMLINKS
40 ln -s repo
/sub
/dir subdir-link
2>/dev
/null
41 test_cd_to_toplevel subdir-link
'at symbolic subdir' SYMLINKS
44 ln -s sub
/dir internal-link
2>/dev
/null
45 test_cd_to_toplevel internal-link
'at internal symbolic subdir' SYMLINKS