Skip to content

Commit fe17fc0

Browse files
committed
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 <[email protected]>
1 parent 4b0891f commit fe17fc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t2300-cd-to-toplevel.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ test_cd_to_toplevel () {
88
test_expect_success $3 "$2" '
99
(
1010
cd '"'$1'"' &&
11-
. "$(git --exec-path)"/git-sh-setup &&
11+
PATH="$(git --exec-path):$PATH" &&
12+
. git-sh-setup &&
1213
cd_to_toplevel &&
1314
[ "$(pwd -P)" = "$TOPLEVEL" ]
1415
)

0 commit comments

Comments
 (0)