mirror of
https://github.com/git-for-windows/git.git
synced 2025-12-15 12:58:18 -06:00
BusyBox-w32 is a true Win32 application, i.e. it does not come with a POSIX emulation layer. That also means that it does *not* use the Unix convention of separating the entries in the PATH variable using colons, but semicolons. However, there are also BusyBox ports to Windows which use a POSIX emulation layer such as Cygwin's or MSYS2's runtime, i.e. using colons as PATH separators. As a tell-tale, let's use the presence of semicolons in the PATH variable: on Unix, it is highly unlikely that it contains semicolons, and on Windows (without POSIX emulation), it is virtually guaranteed, as everybody should have both $SYSTEMROOT and $SYSTEMROOT/system32 in their PATH. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
47 lines
919 B
Bash
Executable File
47 lines
919 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='cd_to_toplevel'
|
|
|
|
. ./test-lib.sh
|
|
|
|
EXEC_PATH="$(git --exec-path)"
|
|
test_have_prereq !MINGW ||
|
|
case "$EXEC_PATH" in
|
|
[A-Za-z]:/*)
|
|
EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
|
|
;;
|
|
esac
|
|
|
|
test_cd_to_toplevel () {
|
|
test_expect_success $3 "$2" '
|
|
(
|
|
cd '"'$1'"' &&
|
|
PATH="$EXEC_PATH$PATH_SEP$PATH" &&
|
|
. git-sh-setup &&
|
|
cd_to_toplevel &&
|
|
[ "$(pwd -P)" = "$TOPLEVEL" ]
|
|
)
|
|
'
|
|
}
|
|
|
|
TOPLEVEL="$(pwd -P)/repo"
|
|
mkdir -p repo/sub/dir
|
|
mv .git repo/
|
|
SUBDIRECTORY_OK=1
|
|
|
|
test_cd_to_toplevel repo 'at physical root'
|
|
|
|
test_cd_to_toplevel repo/sub/dir 'at physical subdir'
|
|
|
|
ln -s repo symrepo 2>/dev/null
|
|
test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
|
|
|
|
ln -s repo/sub/dir subdir-link 2>/dev/null
|
|
test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
|
|
|
|
cd repo
|
|
ln -s sub/dir internal-link 2>/dev/null
|
|
test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS
|
|
|
|
test_done
|