ident: make user_ident_explicitly_given static
[git] / t / t2300-cd-to-toplevel.sh
1 #!/bin/sh
2
3 test_description='cd_to_toplevel'
4
5 . ./test-lib.sh
6
7 test_cd_to_toplevel () {
8         test_expect_success $3 "$2" '
9                 (
10                         cd '"'$1'"' &&
11                         . "$(git --exec-path)"/git-sh-setup &&
12                         cd_to_toplevel &&
13                         [ "$(pwd -P)" = "$TOPLEVEL" ]
14                 )
15         '
16 }
17
18 TOPLEVEL="$(pwd -P)/repo"
19 mkdir -p repo/sub/dir
20 mv .git repo/
21 SUBDIRECTORY_OK=1
22
23 test_cd_to_toplevel repo 'at physical root'
24
25 test_cd_to_toplevel repo/sub/dir 'at physical subdir'
26
27 ln -s repo symrepo 2>/dev/null
28 test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
29
30 ln -s repo/sub/dir subdir-link 2>/dev/null
31 test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
32
33 cd repo
34 ln -s sub/dir internal-link 2>/dev/null
35 test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS
36
37 test_done