summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-02-18 07:12:32 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-02-18 07:12:32 (GMT)
commit372ef954a15c321a1065bf7e764449ce7767277f (patch)
treef52c5bc696f5cf4d93e1ad400cedffae05e385e9 /git-gui.sh
parentb90d479255d3b47e3604493b58e271cb9cd8dccd (diff)
downloadgit-372ef954a15c321a1065bf7e764449ce7767277f.zip
git-372ef954a15c321a1065bf7e764449ce7767277f.tar.gz
git-372ef954a15c321a1065bf7e764449ce7767277f.tar.bz2
git-gui: Correct crash when saving options in blame mode.
Martin Waitz noticed that git-gui crashed while saving the user's options out if the application was started in blame mode. This was caused by the do_save_config procedure invoking reshow_diff incase the number of context lines was modified by the user. Because we bypassed main window UI setup to enter blame mode we did not set many of the globals which were accessed by reshow_diff, and reading unset variables is an error in Tcl. Aside from moving the globals to be set earlier, I also modified reshow_diff to not invoke clear_diff if there is no path currently in the diff viewer. This way reshow_diff does not crash when in blame mode due to the $ui_diff command not being defined. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh36
1 files changed, 21 insertions, 15 deletions
diff --git a/git-gui.sh b/git-gui.sh
index e789801..551c11c 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -361,6 +361,24 @@ set _reponame [lindex [file split \
######################################################################
##
+## global init
+
+set current_diff_path {}
+set current_diff_side {}
+set diff_actions [list]
+set ui_status_value {Initializing...}
+
+set HEAD {}
+set PARENT {}
+set MERGE_HEAD [list]
+set commit_type {}
+set empty_tree {}
+set current_branch {}
+set current_diff_path {}
+set selected_commit_type new
+
+######################################################################
+##
## task management
set rescan_active 0
@@ -682,8 +700,9 @@ proc reshow_diff {} {
global current_diff_path current_diff_side
set p $current_diff_path
- if {$p eq {}
- || $current_diff_side eq {}
+ if {$p eq {}} {
+ # No diff is being shown.
+ } elseif {$current_diff_side eq {}
|| [catch {set s $file_states($p)}]
|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
clear_diff
@@ -5647,9 +5666,6 @@ bind_button3 $ui_comm "tk_popup $ctxm %X %Y"
# -- Diff Header
#
-set current_diff_path {}
-set current_diff_side {}
-set diff_actions [list]
proc trace_current_diff_path {varname args} {
global current_diff_path diff_actions file_states
if {$current_diff_path eq {}} {
@@ -5842,7 +5858,6 @@ unset ui_diff_applyhunk
# -- Status Bar
#
-set ui_status_value {Initializing...}
label .status -textvariable ui_status_value \
-anchor w \
-justify left \
@@ -5916,15 +5931,6 @@ unset i
set file_lists($ui_index) [list]
set file_lists($ui_workdir) [list]
-set HEAD {}
-set PARENT {}
-set MERGE_HEAD [list]
-set commit_type {}
-set empty_tree {}
-set current_branch {}
-set current_diff_path {}
-set selected_commit_type new
-
wm title . "[appname] ([file normalize [file dirname [gitdir]]])"
focus -force $ui_comm