git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-gui: Add Explore Working Copy to the Repository menu

From
Petr Baudis <pasky@suse.cz>
Date
Sep 24, 2008, 22:05 UTC
Message-ID
<1222293953-14320-1-git-send-email-pasky@suse.cz>

Especially when cloning is finished, the Git GUI window pops up, but there is not really much one can do within it - there needs to be a way to easily start exploring and working with the new working copy using the standard system interface: explorer.exe on Windows, open on MacOS/X and xdg-open as a fallback (all modern Linux desktops).

This might be also a post-clone option instead (possibly opening the window automagically) but I believe that this might be useful also in other situations, e.g. you don't have to keep the working copy window around if you work in multiple repositories.

This operation will not make sense on bare repositories.
This patch has been sponsored by Novartis.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 git-gui/git-gui.sh |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 10d8a44..a64d34d 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -1750,6 +1750,19 @@ proc do_gitk {revs} {
 	}
 }
 
+proc do_explore {} {
+	set explorer {}
+	if {[is_Cygwin] || [is_Windows]} {
+		set explorer "explorer.exe"
+	} elseif {[is_MacOSX]} {
+		set explorer "open"
+	} else {
+		# freedesktop.org-conforming system is our best shot
+		set explorer "xdg-open"
+	}
+	eval exec $explorer [file dirname [gitdir]] &
+}
+
 set is_quitting 0
 
 proc do_quit {} {
@@ -2089,6 +2102,11 @@ if {[is_enabled transport]} {
 menu .mbar.repository
 
 .mbar.repository add command \
+	-label [mc "Explore Working Copy"] \
+	-command {do_explore}
+.mbar.repository add separator
+
+.mbar.repository add command \
 	-label [mc "Browse Current Branch's Files"] \
 	-command {browser::new $current_branch}
 set ui_browse_current [.mbar.repository index last]
-- 
tg: (c427559..) t/git-gui/explore (depends on: vanilla/master)
Message 1 of 1 in “git-gui: Add Explore Working Copy to the Repository menu”
  1. git-gui: Add Explore Working Copy to the Repository menuPetr Baudis, Sep 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.