Merge branch 'jc/t2300-setup' into maint

Portability fix for Windows.

* jc/t2300-setup:
  t2300: "git --exec-path" is not usable in $PATH on Windows as-is
maint
Junio C Hamano 2016-07-11 10:44:19 -07:00
commit 3a30c14b9b
1 changed files with 9 additions and 1 deletions

View File

@ -4,11 +4,19 @@ test_description='cd_to_toplevel'


. ./test-lib.sh . ./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_cd_to_toplevel () {
test_expect_success $3 "$2" ' test_expect_success $3 "$2" '
( (
cd '"'$1'"' && cd '"'$1'"' &&
PATH="$(git --exec-path):$PATH" && PATH="$EXEC_PATH:$PATH" &&
. git-sh-setup && . git-sh-setup &&
cd_to_toplevel && cd_to_toplevel &&
[ "$(pwd -P)" = "$TOPLEVEL" ] [ "$(pwd -P)" = "$TOPLEVEL" ]