Re: [PATCH 1/1] mingw: work around t2300's assuming non-Windows paths

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

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

>> 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.
>
> The port does exactly what it is supposed to do: the output of `git
> --exec-path` can be prepended/appended to %PATH%. The point here is:
> %PATH% is *semicolon*-delimited.

I said $PATH because --exec-path does not care what you do with
%PATH% but it deeply cares that its output is usable in $PATH.

I think you would need something similar to "pwd -W", that is, leave
"git --exec-path" as a way to give shell scripts people have written
over the years that allows them to say "git-cmd" as long as they do
PATH="$(git --exec-path):$PATH" upfront.  And for Windows scripts,
introduce a new option "git --exec-path-windows" that can give
C:/git-sdk-64/usr/src/git (or even using backslash).

I do not mean to say that exec_cmd.c::git_exec_path() function must
return a string /c/git-sdk-64/usr/src/git by the above.  It should
keep returning C:/git-sdk-64/usr/src/git, I think.  Its use in
exec_cmd.c::add_path() to use PATH_SEP to do the equivalent
internally for the platform would want C:/git-sdk-64/usr/src/git
there.  Also I think exec_cmd.c::argv_exec_path should keep using
platform native format.

Perhaps you can do the conversion you are doing with this
"let's change t2300" patch instead in C where the return value of
git_exec_path() is fed to puts() in git.c::handle_options(), or
better yet make a helper function git_exec_path_for_shell() that
calls git_exec_path() and does the conversion on Windows (and passes
the result from git_exec_path() intact on other platforms).

I say all of the above because I see this in hits from "git grep -e
--exec-path":

contrib/subtree/git-subtree.sh:PATH=$PATH:$(git --exec-path)

and I would imagine there are countless other shell scripts that
follow the "Output from 'git --exec-path' can be prepended/appended
to PATH to allow you write 'git-cmd' instead of 'git cmd'".  They
would not work unless your "git --exec-path" gives an output that is
usable by shell in $PATH (and not %PATH%).

--
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]