Re: [RFC PATCH 09/19] completion: platform-specific helper function to get physical path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 5/9/2012 2:44, schrieb SZEDER Gábor:
> I'm not sure how to check for MinGW; I just looked through the output from
> 'set', and saw OSTYPE=msys there.

Ususally, we check uname -s for *MINGW* for "portability", but
since a subshell is counter-productive and we are sure that we have a
bash here, I think your check is OK.

> +# __git_pwd_p() stores the physical path of the current working directory
> +# in the variable whose name is given as argument
> +if [ ${OSTYPE-} = "msys" ]; then
> +__git_pwd_p ()
> +{
> +	eval $1="$PWD"
> +}
> +else
> +__git_pwd_p ()
> +{
> +	eval $1=\"$(pwd -P)\"
> +}
> +fi
> +

The following fixup of the quoting is needed at any rate to make the
eval'd commands resistent against directory names with blanks and
double-quotes.

--- >8 ---
From: Johannes Sixt <j6t@xxxxxxxx>
Subject: [PATCH] fixup! completion: platform-specific helper function to get
 physical path

Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
---
 contrib/completion/git-completion.bash |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index bd7d39e..2cab4a0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -75,12 +75,12 @@ esac
 if [ ${OSTYPE-} = "msys" ]; then
 __git_pwd_p ()
 {
-	eval $1="$PWD"
+	eval "$1=\$PWD"
 }
 else
 __git_pwd_p ()
 {
-	eval $1=\"$(pwd -P)\"
+	eval "$1=\$(pwd -P)"
 }
 fi
 
-- 
1.7.10.1.1689.gacdfbde
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]