3 test_description='cd_to_toplevel'
7 EXEC_PATH="$(git --exec-path)"
8 test_have_prereq !MINGW ||
11 EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
15 test_cd_to_toplevel () {
16 test_expect_success $3 "$2" '
19 PATH="$EXEC_PATH:$PATH" &&
22 [ "$(pwd -P)" = "$TOPLEVEL" ]
27 TOPLEVEL="$(pwd -P)/repo"
32 test_cd_to_toplevel repo 'at physical root'
34 test_cd_to_toplevel repo/sub/dir 'at physical subdir'
36 ln -s repo symrepo 2>/dev/null
37 test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
39 ln -s repo/sub/dir subdir-link 2>/dev/null
40 test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
43 ln -s sub/dir internal-link 2>/dev/null
44 test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS