Skip to content

Commit 4ed23c3

Browse files
mark987prati0100
authored andcommitted
git-gui - use cygstart to browse on Cygwin
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 <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Pratyush Yadav <[email protected]>
1 parent 7145c65 commit 4ed23c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-gui.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,9 @@ proc do_git_gui {} {
22742274

22752275
# Get the system-specific explorer app/command.
22762276
proc get_explorer {} {
2277-
if {[is_Cygwin] || [is_Windows]} {
2277+
if {[is_Cygwin]} {
2278+
set explorer "/bin/cygstart.exe --explore"
2279+
} elseif {[is_Windows]} {
22782280
set explorer "explorer.exe"
22792281
} elseif {[is_MacOSX]} {
22802282
set explorer "open"

0 commit comments

Comments
 (0)