]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2300-cd-to-toplevel.sh
Merge branch 'cb/httpd-test-fix-port'
[thirdparty/git.git] / t / t2300-cd-to-toplevel.sh
CommitLineData
08fc0608
MC
1#!/bin/sh
2
3test_description='cd_to_toplevel'
4
5. ./test-lib.sh
6
7test_cd_to_toplevel () {
704a3143 8 test_expect_success $3 "$2" '
08fc0608
MC
9 (
10 cd '"'$1'"' &&
42ac496e 11 . "$(git --exec-path)"/git-sh-setup &&
08fc0608 12 cd_to_toplevel &&
2c3c395e 13 [ "$(pwd -P)" = "$TOPLEVEL" ]
08fc0608
MC
14 )
15 '
16}
17
2c3c395e 18TOPLEVEL="$(pwd -P)/repo"
08fc0608
MC
19mkdir -p repo/sub/dir
20mv .git repo/
21SUBDIRECTORY_OK=1
22
23test_cd_to_toplevel repo 'at physical root'
24
25test_cd_to_toplevel repo/sub/dir 'at physical subdir'
26
704a3143
JS
27ln -s repo symrepo 2>/dev/null
28test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
08fc0608 29
704a3143
JS
30ln -s repo/sub/dir subdir-link 2>/dev/null
31test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
08fc0608
MC
32
33cd repo
704a3143
JS
34ln -s sub/dir internal-link 2>/dev/null
35test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS
08fc0608
MC
36
37test_done