t / t2300-cd-to-toplevel.shon commit Merge branch 'maint-1.6.0' into maint (4f8b899)
   1#!/bin/sh
   2
   3test_description='cd_to_toplevel'
   4
   5. ./test-lib.sh
   6
   7test_cd_to_toplevel () {
   8        test_expect_success "$2" '
   9                (
  10                        cd '"'$1'"' &&
  11                        . git-sh-setup &&
  12                        cd_to_toplevel &&
  13                        [ "$(/bin/pwd)" = "$TOPLEVEL" ]
  14                )
  15        '
  16}
  17
  18TOPLEVEL="$(/bin/pwd)/repo"
  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
  27ln -s repo symrepo
  28test_cd_to_toplevel symrepo 'at symbolic root'
  29
  30ln -s repo/sub/dir subdir-link
  31test_cd_to_toplevel subdir-link 'at symbolic subdir'
  32
  33cd repo
  34ln -s sub/dir internal-link
  35test_cd_to_toplevel internal-link 'at internal symbolic subdir'
  36
  37test_done