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>
This commit is contained in:
parent
36e035f5dc
commit
5e9677cbdf
12
git-am.sh
12
git-am.sh
@ -444,12 +444,12 @@ else
|
|||||||
set x
|
set x
|
||||||
first=
|
first=
|
||||||
}
|
}
|
||||||
case "$arg" in
|
if is_absolute_path "$arg"
|
||||||
/*)
|
then
|
||||||
set "$@" "$arg" ;;
|
set "$@" "$arg"
|
||||||
*)
|
else
|
||||||
set "$@" "$prefix$arg" ;;
|
set "$@" "$prefix$arg"
|
||||||
esac
|
fi
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
@ -209,5 +209,20 @@ case $(uname -s) in
|
|||||||
find () {
|
find () {
|
||||||
/usr/bin/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
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user