From: Pat Thoyts <patthoyts@users•sourceforge.net>
To: Johannes Sixt <j6t@kdbg•org>
Cc: msysgit@googlegroups•com, git@vger•kernel.org,
Junio C Hamano <gitster@pobox•com>,
Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: [PATCH] git-am: fix detection of absolute paths for windows
Date: Thu, 30 Sep 2010 14:24:07 +0100 [thread overview]
Message-ID: <87iq1ly81q.fsf@fox.patthoyts.tk> (raw)
In-Reply-To: <201010011946.12481.j6t@kdbg.org> (Johannes Sixt's message of "Fri, 1 Oct 2010 19:46:12 +0200")
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>
---
Johannes Sixt <j6t@kdbg•org> writes:
>On Donnerstag, 30. September 2010, Pat Thoyts wrote:
>> 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.
>
>Thanks for tackling this!
>
>> @@ -209,5 +209,20 @@ case $(uname -s) in
>> find () {
>> /usr/bin/find "$@"
>> }
>> + is_absolute_path () {
>> + case "$1" in
>> + /* | ?:* | \\\\*)
>
>Absolute paths can also start with a backslash, and UNC paths can start with
>double-slash. Therefore, this should be:
>
> [/\\]* | [A-Za-z]:*)
>
>> + return 0 ;;
>> + esac
>> + return 1
>> + }
>
>-- Hannes
I've modified the patch and added your signoff - hopefully that is ok?
git-am.sh | 12 ++++++------
git-sh-setup.sh | 15 +++++++++++++++
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index e7f008c..9317b38 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -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 6131670..58d30c9 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
--
1.7.3
next prev parent reply other threads:[~2010-10-01 20:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 9:46 Pull request for msysGit patches Pat Thoyts
2010-09-28 19:10 ` Junio C Hamano
2010-09-28 21:11 ` [msysGit] " Johannes Sixt
2010-09-29 3:41 ` Junio C Hamano
2010-09-28 21:23 ` Ævar Arnfjörð Bjarmason
2010-09-30 22:15 ` Pat Thoyts
2010-09-30 22:52 ` Ævar Arnfjörð Bjarmason
2010-09-30 23:27 ` Erik Faye-Lund
2010-09-29 2:01 ` [msysGit] " Eric Sunshine
[not found] ` <7vbp7hrzhb.fsf@alter.siamese.dyndns.org>
2010-09-29 3:54 ` Eric Sunshine
2010-09-29 22:22 ` msysGit patches for upstream Pat Thoyts
2010-09-29 23:02 ` Junio C Hamano
2010-09-29 22:22 ` [PATCH 1/2] Make sure that git_getpass() never returns NULL Pat Thoyts
2010-09-29 22:22 ` [PATCH 2/2] Fix typo in pack-objects' usage Pat Thoyts
2010-09-28 20:52 ` [msysGit] Pull request for msysGit patches Johannes Sixt
2010-09-28 20:58 ` Erik Faye-Lund
2010-09-28 21:13 ` Johannes Sixt
2010-09-28 21:20 ` Erik Faye-Lund
2010-09-28 21:35 ` Erik Faye-Lund
2010-09-28 21:08 ` Jonathan Nieder
2010-09-29 17:51 ` Junio C Hamano
2010-09-29 22:29 ` Pat Thoyts
2010-09-29 2:23 ` Eric Sunshine
2010-09-29 3:37 ` Junio C Hamano
2010-09-29 4:17 ` Eric Sunshine
2010-09-30 13:24 ` [PATCH] git-am: fix detection of absolute paths for windows Pat Thoyts
2010-10-01 17:46 ` Johannes Sixt
2010-09-30 13:24 ` Pat Thoyts [this message]
2010-11-07 14:56 ` [PATCH v2 0/4] make open/unlink failures user friendly on windows using retry/abort Heiko Voigt
2010-11-07 14:56 ` [PATCH v2 1/4] mingw: move unlink wrapper to mingw.c Heiko Voigt
2010-11-07 14:56 ` [PATCH v2 2/4] mingw: work around irregular failures of unlink on windows Heiko Voigt
2010-11-07 14:56 ` [PATCH v2 3/4] mingw: make failures to unlink or move raise a question Heiko Voigt
2010-11-07 14:56 ` [PATCH v2 4/4] mingw: add fallback for rmdir in case directory is in use Heiko Voigt
2010-11-07 15:49 ` [PATCH v2 0/4] make open/unlink failures user friendly on windows using retry/abort Johannes Sixt
2010-11-07 17:06 ` Heiko Voigt
2010-11-07 19:11 ` Johannes Sixt
2010-09-29 6:11 ` Pull request for msysGit patches yj2133011
2010-09-29 20:48 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iq1ly81q.fsf@fox.patthoyts.tk \
--to=patthoyts@users$(echo .)sourceforge.net \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=j6t@kdbg$(echo .)org \
--cc=msysgit@googlegroups$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox