diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-06-01 13:30:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-01 14:15:17 -0700 |
commit | fe17fc0006927246c5905ef9352e7e89a3c5814b (patch) | |
tree | 9d123e6ba9acb8c53bd2a4777e0c44ceba8d7aee | |
parent | More topics for 2.8.4 (diff) | |
download | tgif-fe17fc0006927246c5905ef9352e7e89a3c5814b.tar.xz |
t2300: run git-sh-setup in an environment that better mimics the real life
When we run scripted Porcelains, "git" potty has set up the $PATH by
prepending $GIT_EXEC_PATH, the path given by "git --exec-path=$there
$cmd", etc. already. Because of this, scripted Porcelains can
dot-source shell script library like git-sh-setup with simple dot
without specifying any path.
t2300 however dot-sources git-sh-setup without adjusting $PATH like
the real "git" potty does. This has not been a problem so far, but
once git-sh-setup wants to rely on the $PATH adjustment, just like
any scripted Porcelains already do, it would become one. It cannot
for example dot-source another shell library without specifying the
full path to it by prefixing $(git --exec-path).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | t/t2300-cd-to-toplevel.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh index 9965bc5c92..cccd7d923a 100755 --- a/t/t2300-cd-to-toplevel.sh +++ b/t/t2300-cd-to-toplevel.sh @@ -8,7 +8,8 @@ test_cd_to_toplevel () { test_expect_success $3 "$2" ' ( cd '"'$1'"' && - . "$(git --exec-path)"/git-sh-setup && + PATH="$(git --exec-path):$PATH" && + . git-sh-setup && cd_to_toplevel && [ "$(pwd -P)" = "$TOPLEVEL" ] ) |