Skip to content

Commit a6f7aa4

Browse files
committed
subtree: fix assumption about the directory separator
On Windows, both forward and backslash are valid separators. In 22d5507 (subtree: don't fuss with PATH, 2021-04-27), however, we added code that assumes that it can only be the forward slash. Let's fix that. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5f2d943 commit a6f7aa4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ if test -z "$GIT_EXEC_PATH" || ! test -f "$GIT_EXEC_PATH/git-sh-setup" || {
1010
test ! "$GIT_EXEC_PATH" -ef "${PATH%%:*}" 2>/dev/null
1111
}
1212
then
13+
basename=${0##*[/\\]}
1314
echo >&2 'It looks like either your git installation or your'
1415
echo >&2 'git-subtree installation is broken.'
1516
echo >&2
1617
echo >&2 "Tips:"
1718
echo >&2 " - If \`git --exec-path\` does not print the correct path to"
1819
echo >&2 " your git install directory, then set the GIT_EXEC_PATH"
1920
echo >&2 " environment variable to the correct directory."
20-
echo >&2 " - Make sure that your \`${0##*/}\` file is either in your"
21+
echo >&2 " - Make sure that your \`$basename\` file is either in your"
2122
echo >&2 " PATH or in your git exec path (\`$(git --exec-path)\`)."
22-
echo >&2 " - You should run git-subtree as \`git ${0##*/git-}\`,"
23-
echo >&2 " not as \`${0##*/}\`." >&2
23+
echo >&2 " - You should run git-subtree as \`git ${basename#git-}\`,"
24+
echo >&2 " not as \`$basename\`." >&2
2425
exit 126
2526
fi
2627

0 commit comments

Comments
 (0)