Re: [RFC PATCH 09/19] completion: platform-specific helper function to get physical path
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- May 9, 2012, 07:37 UTC
- Message-ID
- <4FAA1EC7.5030200@viscovery.net>
- In-Reply-To
- <1336524290-30023-10-git-send-email-szeder@ira.uka.de>
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.
Show 14 quoted lines
> +# __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@kdbg.org> Subject: [PATCH] fixup! completion: platform-specific helper function to get physical path
Signed-off-by: Johannes Sixt <j6t@kdbg.org> --- 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