mirror of
https://github.com/git-for-windows/git.git
synced 2026-02-03 18:59:59 -06:00
mingw: only use Bash-ism builtin pwd -W when available
Traditionally, Git for Windows' SDK uses Bash as its default shell. However, other Unix shells are available, too. Most notably, the Win32 port of BusyBox comes with `ash` whose `pwd` command already prints Windows paths as Git for Windows wants them, while there is not even a `builtin` command. Therefore, let's be careful not to override `pwd` unless we know that the `builtin` command is available. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
6e6763c05e
commit
1656ddf364
@ -306,10 +306,16 @@ case $(uname -s) in
|
|||||||
/usr/bin/find "$@"
|
/usr/bin/find "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
# git sees Windows-style pwd
|
# On Windows, Git wants Windows paths. But /usr/bin/pwd spits out
|
||||||
pwd () {
|
# Unix-style paths. At least in Bash, we have a builtin pwd that
|
||||||
builtin pwd -W
|
# understands the -W option to force "mixed" paths, i.e. with drive
|
||||||
}
|
# prefix but still with forward slashes. Let's use that, if available.
|
||||||
|
if type builtin >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
pwd () {
|
||||||
|
builtin pwd -W
|
||||||
|
}
|
||||||
|
fi
|
||||||
is_absolute_path () {
|
is_absolute_path () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
[/\\]* | [A-Za-z]:*)
|
[/\\]* | [A-Za-z]:*)
|
||||||
|
|||||||
@ -1685,10 +1685,16 @@ Darwin)
|
|||||||
/usr/bin/find "$@"
|
/usr/bin/find "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
# git sees Windows-style pwd
|
# On Windows, Git wants Windows paths. But /usr/bin/pwd spits out
|
||||||
pwd () {
|
# Unix-style paths. At least in Bash, we have a builtin pwd that
|
||||||
builtin pwd -W
|
# understands the -W option to force "mixed" paths, i.e. with drive
|
||||||
}
|
# prefix but still with forward slashes. Let's use that, if available.
|
||||||
|
if type builtin >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
pwd () {
|
||||||
|
builtin pwd -W
|
||||||
|
}
|
||||||
|
fi
|
||||||
# no POSIX permissions
|
# no POSIX permissions
|
||||||
# backslashes in pathspec are converted to '/'
|
# backslashes in pathspec are converted to '/'
|
||||||
# exec does not inherit the PID
|
# exec does not inherit the PID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user