From: Junio C Hamano <gitster@pobox.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>, git@vger.kernel.org
Subject: Re: [GIT GUI PATCH 1/2] git-gui: teach _which procedure to work with absolute paths
Date: Fri, 23 Mar 2012 12:31:03 -0700 [thread overview]
Message-ID: <7v8virt8qw.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <e7a733b5ad4e2009aec205235a95a610ee18947b.1332523097.git.hvoigt@hvoigt.net> (Heiko Voigt's message of "Fri, 23 Mar 2012 18:30:27 +0100")
Heiko Voigt <hvoigt@hvoigt.net> writes:
> _which is useful to check whether a certain command can be called.
> Previously when given an absolute path it would not recognize it as
> an existing program. Lets change that so it transparently handles such
> cases.
>
> Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
> ---
> git-gui/git-gui.sh | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index ba4e5c1..35cdee8 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -429,6 +429,10 @@ proc _git_cmd {name} {
> proc _which {what args} {
> global env _search_exe _search_path
>
> + if {[file exists $what]} {
> + return [file normalize $what]
> + }
Has $what been verified that it is either an absolute path, or contains a
directory separator, at this point in the code?
Otherwise, "_which Makefile" would say "Yeah, that is the one I will
launch" in a directory that has a "Makefile" even when the user does not
have "." in his $PATH, no?
> if {$_search_path eq {}} {
> if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
> set _search_path [split [exec cygpath \
next prev parent reply other threads:[~2012-03-23 19:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 17:30 [GIT GUI PATCH 0/2] teach git gui to open the configured editor Heiko Voigt
2012-03-23 17:30 ` [GIT GUI PATCH 1/2] git-gui: teach _which procedure to work with absolute paths Heiko Voigt
2012-03-23 19:31 ` Junio C Hamano [this message]
2012-03-25 17:09 ` Heiko Voigt
2012-03-23 17:30 ` [GIT GUI PATCH 2/2] git-gui: add "open in editor" diff context menu entry Heiko Voigt
2012-03-23 18:43 ` [GIT GUI PATCH 0/2] teach git gui to open the configured editor Bert Wesarg
2012-03-25 17:02 ` Heiko Voigt
2012-03-25 19:33 ` Bert Wesarg
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=7v8virt8qw.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=patthoyts@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).