git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Levedahl <mlevedahl@gmail.com>
To: mdl123@verizon.net, git@vger.kernel.org
Cc: adam@dinwoodie.org, me@yadavpratyush.com,
	johannes.schindelin@gmx.de, gitster@pobox.com,
	sunshine@sunshineco.com, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH v1 3/4] git-gui - use cygstart to browse on Cygwin
Date: Mon, 26 Jun 2023 12:53:04 -0400	[thread overview]
Message-ID: <20230626165305.37488-4-mlevedahl@gmail.com> (raw)
In-Reply-To: <20230626165305.37488-1-mlevedahl@gmail.com>

git-gui enables the "Repository->Explore Working Copy" menu on Cygwin,
offering to open a Windows graphical file browser at the root of the
working directory. This code, shared with Git For Windows support,
depends upon use of Windows pathnames. However, git gui on Cygwin uses
unix pathnames, so this shared code will not work on Cygwin.

A base install of Cygwin provides the /bin/cygstart utility that runs
a registered Windows application based upon the file type, after
translating unix pathnames to Windows.  Adding the --explore option
guarantees that the Windows file explorer is opened, regardless of the
supplied pathname's file type and avoiding possibility of some other
action being taken.

So, teach git-gui to use cygstart --explore on Cygwin, restoring the
pre-2012 behavior of opening a Windows file explorer for browsing. This
separates the Git For Windows and Cygwin code paths. Note that
is_Windows is never true on Cygwin, and is_Cygwin is never true on Git
for Windows, though this is not obvious by examining the code for those
independent functions.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
changes since v0
 -- assumes the if/else tree being modified is untouched by prior
    patches making the changes minimal and easier to review.

 git-gui.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/git-gui.sh b/git-gui.sh
index 3f7c31e..8bc8892 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2274,7 +2274,9 @@ proc do_git_gui {} {
 
 # Get the system-specific explorer app/command.
 proc get_explorer {} {
-	if {[is_Cygwin] || [is_Windows]} {
+	if {[is_Cygwin]} {
+		set explorer "/bin/cygstart.exe --explore"
+	} elseif {[is_Windows]} {
 		set explorer "explorer.exe"
 	} elseif {[is_MacOSX]} {
 		set explorer "open"
-- 
2.41.0.99.19


  parent reply	other threads:[~2023-06-26 16:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-24 21:23 [PATCH v0 0/4] Remove obsolete Cygwin support from git-gui Mark Levedahl
2023-06-24 21:23 ` [PATCH v0 1/4] git gui Makefile - remove Cygwin modiifications Mark Levedahl
2023-06-24 21:23 ` [PATCH v0 2/4] git-gui - remove obsolete Cygwin specific code Mark Levedahl
2023-06-25  2:56   ` Eric Sunshine
2023-06-25 11:29     ` Mark Levedahl
2023-06-24 21:23 ` [PATCH v0 3/4] git-gui - use cygstart to browse on Cygwin Mark Levedahl
2023-06-24 21:23 ` [PATCH v0 4/4] git-gui - use mkshortcut " Mark Levedahl
2023-06-24 23:30 ` [PATCH v0 0/4] Remove obsolete Cygwin support from git-gui Junio C Hamano
2023-06-24 23:35   ` Junio C Hamano
2023-06-25 11:28     ` Mark Levedahl
2023-06-25 11:26   ` Mark Levedahl
2023-06-25 12:10     ` Mark Levedahl
2023-06-25 15:46     ` Junio C Hamano
2023-06-25 17:01       ` Mark Levedahl
2023-06-26 15:52         ` Junio C Hamano
2023-06-26 16:55           ` Mark Levedahl
2023-06-26 16:53 ` [PATCH v1 " Mark Levedahl
2023-06-26 16:53   ` [PATCH v1 1/4] git gui Makefile - remove Cygwin modifications Mark Levedahl
2023-06-26 16:53   ` [PATCH v1 2/4] git-gui - remove obsolete Cygwin specific code Mark Levedahl
2023-06-26 16:53   ` Mark Levedahl [this message]
2023-06-26 16:53   ` [PATCH v1 4/4] git-gui - use mkshortcut on Cygwin Mark Levedahl
2023-06-27 11:51   ` [PATCH v1 0/4] Remove obsolete Cygwin support from git-gui Johannes Schindelin
2023-06-27 17:52   ` Junio C Hamano
2023-08-05 14:47     ` Mark Levedahl
2023-08-24 15:54       ` Pratyush Yadav
2023-08-29 16:03     ` Mark Levedahl
2023-08-29 16:18       ` Junio C Hamano

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=20230626165305.37488-4-mlevedahl@gmail.com \
    --to=mlevedahl@gmail.com \
    --cc=adam@dinwoodie.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=mdl123@verizon.net \
    --cc=me@yadavpratyush.com \
    --cc=sunshine@sunshineco.com \
    /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).