Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t2300-cd-to-toplevel.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t2300-cd-to-toplevel.sh` 46 lines ยท 911 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='cd_to_toplevel' 4 5 . ./test-lib.sh 6 7 EXEC_PATH="$(git --exec-path)" 8 test_have_prereq !MINGW || 9 case "$EXEC_PATH" in 10 [A-Za-z]:/*) 11 EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}" 12 ;; 13 esac 14 15 test_cd_to_toplevel () { 16 test_expect_success $3 "$2" ' 17 ( 18 cd '"'$1'"' && 19 PATH="$EXEC_PATH:$PATH" && 20 . git-sh-setup && 21 cd_to_toplevel && 22 [ "$(pwd -P)" = "$TOPLEVEL" ] 23 ) 24 ' 25 } 26 27 TOPLEVEL="$(pwd -P)/repo" 28 mkdir -p repo/sub/dir 29 mv .git repo/ 30 SUBDIRECTORY_OK=1 31 32 test_cd_to_toplevel repo 'at physical root' 33 34 test_cd_to_toplevel repo/sub/dir 'at physical subdir' 35 36 ln -s repo symrepo 2>/dev/null 37 test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS 38 39 ln -s repo/sub/dir subdir-link 2>/dev/null 40 test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS 41 42 cd repo 43 ln -s sub/dir internal-link 2>/dev/null 44 test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS 45 46 test_done