@matheusbsbs / matheus-bagliano / commits / 5e9677cbdf
Fork 0

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>

Pat Thoyts committed Sep 30, 2010 at 14:24 UTC 5e9677cbdf1840836e22d9cf23198de34877e283
2 files changed +21 -6
git-am.sh
+6 -6
@@ -444,12 +444,12 @@ else
444 set x
445 first=
446 }
447 - case "$arg" in
448 - /*)
449 - set "$@" "$arg" ;;
450 - *)
451 - set "$@" "$prefix$arg" ;;
452 - esac
447 + if is_absolute_path "$arg"
448 + then
449 + set "$@" "$arg"
450 + else
451 + set "$@" "$prefix$arg"
452 + fi
453 done
454 shift
455 fi
git-sh-setup.sh
+15
@@ -209,5 +209,20 @@ case $(uname -s) in
209 find () {
210 /usr/bin/find "$@"
211 }
212 + is_absolute_path () {
213 + case "$1" in
214 + [/\\]* | [A-Za-z]:*)
215 + return 0 ;;
216 + esac
217 + return 1
218 + }
219 ;;
220 +*)
221 + is_absolute_path () {
222 + case "$1" in
223 + /*)
224 + return 0 ;;
225 + esac
226 + return 1
227 + }
228 esac