summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-11-11 18:42:42 -0500
committerShawn O. Pearce <spearce@spearce.org>2006-11-12 00:16:01 -0500
commit73ad179bbbba56c053045c555b7e5f1882380533 (patch)
treede8f738391f0de646ef2740a833597745a735558 /git-gui
parent7f1df79bb7bad696d1d8965da3937edeb1cfe9f6 (diff)
downloadgit-73ad179bbbba56c053045c555b7e5f1882380533.tar.gz
git-gui: Use catch rather than array names to check file.
When we reshow the current diff file it can be faster to just fetch the value from the file_states array than it is to ask for all paths whose name exactly matches the one we want to show. This is because [array names -exact] is O(n) in the number of files. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui8
1 files changed, 4 insertions, 4 deletions
diff --git a/git-gui b/git-gui
index 2c4e97236b..e16fcf7346 100755
--- a/git-gui
+++ b/git-gui
@@ -350,11 +350,11 @@ proc clear_diff {} {
proc reshow_diff {} {
global ui_fname_value ui_status_value file_states
- if {$ui_fname_value != {} && [array names file_states \
- -exact $ui_fname_value] != {}} {
- show_diff $ui_fname_value
- } else {
+ if {$ui_fname_value == {}
+ || [catch {set s $file_states($ui_fname_value)}]} {
clear_diff
+ } else {
+ show_diff $ui_fname_value
}
}