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

[RFC PATCH 4/8] git gui: teach fetch operation to close dialog on successful completion

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Sep 21, 2009, 13:06 UTC
Message-ID
<1e2889356b0992c64fe0d5efefa4c9c47af2513f.1253481338.git.hvoigt@hvoigt.net>
In-Reply-To
<3ee2f1d36ed3c4b716f9bdb2a8f7fcde9a5f9357.1253481338.git.hvoigt@hvoigt.net>
---
 git-gui/lib/console.tcl   |    6 ++++++
 git-gui/lib/transport.tcl |   12 ++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl
index c112464..84eef13 100644
--- a/git-gui/lib/console.tcl
+++ b/git-gui/lib/console.tcl
@@ -168,6 +168,7 @@ method chain {cmdlist {ok 1}} {
 	} else {
 		done $this $ok
 	}
+	return $ok
 }
 
 method insert {txt} {
@@ -178,6 +179,11 @@ method insert {txt} {
 	$w_t conf -state disabled
 }
 
+method close_window {} {
+	wm protocol $w WM_DELETE_WINDOW {}
+	destroy $w
+}
+
 method done {ok} {
 	if {$ok} {
 		if {[winfo exists $w.m.s]} {
diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index d717468..39443ab 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -1,7 +1,7 @@
 # git-gui transport (fetch/push) support
 # Copyright (C) 2006, 2007 Shawn Pearce
 
-proc fetch_from {remote} {
+proc fetch_from {remote {close_after {}}} {
 	set w [console::new \
 		[mc "fetch %s" $remote] \
 		[mc "Fetching new changes from %s" $remote]]
@@ -10,7 +10,15 @@ proc fetch_from {remote} {
 	if {[is_config_true gui.pruneduringfetch]} {
 		lappend cmds [list exec git remote prune $remote]
 	}
-	console::chain $w $cmds
+	set ok [console::chain $w $cmds]
+
+	if {$ok} {
+		if {$close_after ne {}} {
+			console::close_window $w
+		}
+		return 1
+	}
+	return 0
 }
 
 proc prune_from {remote} {
-- 
1.6.5.rc1.12.gc72fe
Previous: Heiko VoigtNext: Heiko Voigt
Message 5 of 9 in “Extend git gui for better "centralized" workflow integration”
  1. 0/8 Extend git gui for better "centralized" workflow integrationHeiko Voigt, Sep 21, 2009
  2. 1/8 git gui: add a "compose review email" checkbox to push dialogHeiko Voigt, Sep 21, 2009
  3. 2/8 git gui: teach delete dialog to open with a default remoteHeiko Voigt, Sep 21, 2009
  4. 3/8 git gui: add checkbox to launch remote branch delete after pushHeiko Voigt, Sep 21, 2009
  5. 4/8 git gui: teach fetch operation to close dialog on successful completionHeiko Voigt, Sep 21, 2009
  6. 5/8 git gui: do fetch from a default remote on startupHeiko Voigt, Sep 21, 2009
  7. 6/8 git gui: add "review topic" menuitem which supports feature branch workflowHeiko Voigt, Sep 21, 2009
  8. 7/8 Add documentation for git gui variables for email and delete after pushHeiko Voigt, Sep 21, 2009
  9. 8/8 git gui: make gc hint and fetch on startup sequentialHeiko Voigt, Sep 21, 2009

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.