[RFC PATCH 5/8] git gui: do fetch from a default remote on startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In many situations the very first thing you do after starting git gui is
to fetch the newest changes from your main remote. Lets have git gui do
the work automatically and save us some clicking.

We add two configuration variables (one to enable the feature and one
specifying the default remote) so the remote can be reused in another
patch which adds a "Review Topic" merge item later in this series.
---
 git-gui/git-gui.sh     |    8 ++++++++
 git-gui/lib/option.tcl |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index b32b8e7..2a2bd38 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -740,6 +740,8 @@ set default_config(gui.fastcopyblame) false
 set default_config(gui.emailafterpush) false
 set default_config(gui.deleteafterpush) false
 set default_config(gui.upstreambranch) {master}
+set default_config(gui.defaultremote) {origin}
+set default_config(gui.fetchonstartup) false
 set default_config(gui.copyblamethreshold) 40
 set default_config(gui.blamehistoryctx) 7
 set default_config(gui.diffcontext) 5
@@ -3495,6 +3497,12 @@ after 1 {
 		$ui_comm configure -state disabled -background gray
 	}
 }
+
+set defaultremote $repo_config(gui.defaultremote)
+if {[is_config_true gui.fetchonstartup] && $defaultremote ne {}} {
+	after 500 {fetch_from $defaultremote {close_on_success}}
+}
+
 if {[is_enabled multicommit]} {
 	after 1000 hint_gc
 }
diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl
index 6bfe343..defeb54 100644
--- a/git-gui/lib/option.tcl
+++ b/git-gui/lib/option.tcl
@@ -149,7 +149,9 @@ proc do_options {} {
 		{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
 		{b gui.emailafterpush {mc "Open Email Composer after Push of Feature Branch"}}
 		{b gui.deleteafterpush {mc "Open Remote Delete Dialog On Push of Upstream Branch"}}
+		{b gui.fetchonstartup {mc "Fetch default remote on startup"}}
 		{t gui.upstreambranch {mc "Upstream branch"}}
+		{t gui.defaultremote {mc "Default remote repository"}}
 		{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
 		{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
 		{i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
-- 
1.6.5.rc1.12.gc72fe

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]