diff options
author | Pat Thoyts <patthoyts@users.sourceforge.net> | 2010-09-30 15:24:07 +0200 |
---|---|---|
committer | Pat Thoyts <patthoyts@users.sourceforge.net> | 2010-10-04 00:31:59 +0200 |
commit | 5e9677cbdf1840836e22d9cf23198de34877e283 (patch) | |
tree | 449c3b8f4b22f197f4ef70ffcda99b302bcb8c7c | |
parent | Side-step MSYS-specific path "corruption" leading to t5560 failure. (diff) | |
download | git-5e9677cbdf1840836e22d9cf23198de34877e283.tar.xz git-5e9677cbdf1840836e22d9cf23198de34877e283.zip |
git-am: fix detection of absolute paths for windows
Add an is_absolute_path function to abstract out platform differences
in checking for an absolute or relative path.
Specifically fixes t4150-am on Windows.
[PT: updated following suggestion from j6t to support \* and //*]
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Diffstat (limited to '')
-rwxr-xr-x | git-am.sh | 12 | ||||
-rw-r--r-- | git-sh-setup.sh | 15 |
2 files changed, 21 insertions, 6 deletions
@@ -444,12 +444,12 @@ else set x first= } - case "$arg" in - /*) - set "$@" "$arg" ;; - *) - set "$@" "$prefix$arg" ;; - esac + if is_absolute_path "$arg" + then + set "$@" "$arg" + else + set "$@" "$prefix$arg" + fi done shift fi diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 6131670860..58d30c9388 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -209,5 +209,20 @@ case $(uname -s) in find () { /usr/bin/find "$@" } + is_absolute_path () { + case "$1" in + [/\\]* | [A-Za-z]:*) + return 0 ;; + esac + return 1 + } ;; +*) + is_absolute_path () { + case "$1" in + /*) + return 0 ;; + esac + return 1 + } esac |