public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Johannes Schindelin <johannes.schindelin@gmx•de>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 1/1] mingw: work around t2300's assuming non-Windows paths
Date: Mon, 20 Jun 2016 12:09:24 -0700	[thread overview]
Message-ID: <xmqqmvmfu17f.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <a8bebe126bcd047720a13e90b85b8dccb7231187.1466246919.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Sat, 18 Jun 2016 12:49:11 +0200 (CEST)")

Johannes Schindelin <johannes.schindelin@gmx•de> writes:

> On Windows, we have to juggle two different schemes of representing
> paths: the native, Windows paths (the only ones known to the main
> Git executable) on the one hand, and POSIX-ish ones used by the Bash
> through MSYS2's POSIX emulation layer on the other hand.
>
> A Windows path looks like this: C:\git-sdk-64\usr\src\git. In modern
> Windows, it is almost always legal to use forward slashes as directory
> separators, which is the reason why the Git executable itself would use
> the path C:/git-sdk-64/usr/src/git instead. The equivalent POSIX-ish
> path would be: /c/git-sdk-64/usr/src/git.
>
> This patch works around the assumption of t2300-cd-to-toplevel.sh that
> `git --exec-path` spits out a POSIX-ish path, by converting the output
> accordingly.

Hmm, I am confused.  `git --exec-path` _is_ meant to "spit out" a
path that is usable when prepended/appended to $PATH [1], and it
does _not_ have to be POSIX-ish path.  It is totally up to the port
to adjust it to the platform's convention how the $PATH environment
variable is understood.

If $PATH cannot take C:/git-sdk-64/usr/src/git but does understand
/c/git-sdk-64/usr/src/git, perhaps "git --exec-path" should be
emitting the latter in the first place?


[Footnote]

*1* That after all was how we handled the painful 1.6 "'git-cmd' to
'git cmd'" transition (cf. $gmane/93793).



> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx•de>
> ---
>  t/t2300-cd-to-toplevel.sh | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh
> index cccd7d9..c8de6d8 100755
> --- a/t/t2300-cd-to-toplevel.sh
> +++ b/t/t2300-cd-to-toplevel.sh
> @@ -4,11 +4,19 @@ test_description='cd_to_toplevel'
>  
>  . ./test-lib.sh
>  
> +EXEC_PATH="$(git --exec-path)"
> +test_have_prereq !MINGW ||
> +case "$EXEC_PATH" in
> +[A-Za-z]:/*)
> +	EXEC_PATH="/${EXEC_PATH%%:*}${EXEC_PATH#?:}"
> +	;;
> +esac
> +
>  test_cd_to_toplevel () {
>  	test_expect_success $3 "$2" '
>  		(
>  			cd '"'$1'"' &&
> -			PATH="$(git --exec-path):$PATH" &&
> +			PATH="$EXEC_PATH:$PATH" &&
>  			. git-sh-setup &&
>  			cd_to_toplevel &&
>  			[ "$(pwd -P)" = "$TOPLEVEL" ]

  reply	other threads:[~2016-06-20 19:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18 10:49 [PATCH 0/1] Fix testing of `master` on Windows Johannes Schindelin
2016-06-18 10:49 ` [PATCH 1/1] mingw: work around t2300's assuming non-Windows paths Johannes Schindelin
2016-06-20 19:09   ` Junio C Hamano [this message]
2016-06-21 12:01     ` Johannes Schindelin
2016-06-21 17:10       ` Junio C Hamano
2016-06-21 17:27         ` Junio C Hamano
2016-06-22  8:25           ` Johannes Schindelin
2016-06-22 16:42             ` Junio C Hamano
2016-06-22 20:06               ` Johannes Schindelin
2016-06-22 20:12               ` Junio C Hamano
2016-06-22 21:26                 ` Johannes Schindelin

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=xmqqmvmfu17f.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=johannes.schindelin@gmx$(echo .)de \
    /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