git-gui: Allow the user to disable diff stat summary during pull.
[gitweb.git] / git-gui
diff --git a/git-gui b/git-gui
index 249b2c894a3f0b4091d46ad80a298696449b9ea8..761ce7551f8250fba693ecc8d516cb7f00303e6e 100755 (executable)
--- a/git-gui
+++ b/git-gui
@@ -24,24 +24,27 @@ proc is_many_config {name} {
        }
 }
 
-proc load_config {} {
+proc load_config {include_global} {
        global repo_config global_config default_config
 
        array unset global_config
-       array unset repo_config
-       catch {
-               set fd_rc [open "| git repo-config --global --list" r]
-               while {[gets $fd_rc line] >= 0} {
-                       if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
-                               if {[is_many_config $name]} {
-                                       lappend global_config($name) $value
-                               } else {
-                                       set global_config($name) $value
+       if {$include_global} {
+               catch {
+                       set fd_rc [open "| git repo-config --global --list" r]
+                       while {[gets $fd_rc line] >= 0} {
+                               if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
+                                       if {[is_many_config $name]} {
+                                               lappend global_config($name) $value
+                                       } else {
+                                               set global_config($name) $value
+                                       }
                                }
                        }
+                       close $fd_rc
                }
-               close $fd_rc
        }
+
+       array unset repo_config
        catch {
                set fd_rc [open "| git repo-config --list" r]
                while {[gets $fd_rc line] >= 0} {
@@ -893,8 +896,7 @@ proc fetch_from {remote} {
 }
 
 proc pull_remote {remote branch} {
-       global HEAD commit_type
-       global file_states
+       global HEAD commit_type file_states repo_config
 
        if {![lock_index update]} return
 
@@ -930,6 +932,9 @@ Commit or throw away all changes before starting a pull operation.
        set w [new_console "pull $remote $branch" \
                "Pulling new changes from branch $branch in $remote"]
        set cmd [list git pull]
+       if {$repo_config(gui.pullsummary) == {false}} {
+               lappend cmd --no-summary
+       }
        lappend cmd $remote
        lappend cmd $branch
        console_exec $w $cmd [list post_pull_remote $remote $branch]
@@ -1711,7 +1716,7 @@ proc do_options {} {
        global repo_config global_config
        global repo_config_new global_config_new
 
-       load_config
+       load_config 1
        array unset repo_config_new
        array unset global_config_new
        foreach name [array names repo_config] {
@@ -1757,6 +1762,7 @@ proc do_options {} {
        pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5
 
        foreach option {
+               {pullsummary {Show Pull Summary}}
                {trustmtime {Trust File Modification Timestamps}}
                } {
                set name [lindex $option 0]
@@ -1913,13 +1919,14 @@ proc apply_config {} {
 }
 
 set default_config(gui.trustmtime) false
+set default_config(gui.pullsummary) true
 set default_config(gui.fontui) [font configure font_ui]
 set default_config(gui.fontdiff) [font configure font_diff]
 set font_descs {
        {fontui   font_ui   {Main Font}}
        {fontdiff font_diff {Diff/Console Font}}
 }
-load_config
+load_config 0
 apply_config
 
 ######################################################################