@matheusbsbs / matheus-bagliano / commits / 418c4c7bce
Fork 0

gitk: Add braces around if expressions

Apparently this simplifies things for the parser/compiler and makes it go slightly faster (since without the braces, it potentially has to do two levels of substitutions rather than one). Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Feb 7, 2006 at 09:10 UTC 418c4c7bceb7276e2a95772aa34f0cee5e1c47e8
1 file changed +11 -9
gitk
+11 -9
@@ -19,10 +19,10 @@ proc gitdir {} {
19 proc parse_args {rargs} {
20 global parsed_args
21
22 - if [catch {
22 + if {[catch {
23 set parse_args [concat --default HEAD $rargs]
24 set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
25 - }] {
25 + }]} {
26 # if git-rev-parse failed for some reason...
27 if {$rargs == {}} {
28 set rargs HEAD
@@ -39,10 +39,10 @@ proc start_rev_list {rlargs} {
39 set startmsecs [clock clicks -milliseconds]
40 set nextupdate [expr {$startmsecs + 100}]
41 set ncmupdate 1
42 - if [catch {
42 + if {[catch {
43 set commfd [open [concat | git-rev-list --header --topo-order \
44 --parents $rlargs] r]
45 - } err] {
45 + } err]} {
46 puts stderr "Error executing git-rev-list: $err"
47 exit 1
48 }
@@ -181,7 +181,7 @@ proc doupdate {reading} {
181 }
182
183 proc readcommit {id} {
184 - if [catch {set contents [exec git-cat-file commit $id]}] return
184 + if {[catch {set contents [exec git-cat-file commit $id]}]} return
185 parsecommit $id $contents 0 {}
186 }
187
@@ -679,7 +679,7 @@ proc savestuff {w} {
679
680 proc resizeclistpanes {win w} {
681 global oldwidth
682 - if [info exists oldwidth($win)] {
682 + if {[info exists oldwidth($win)]} {
683 set s0 [$win sash coord 0]
684 set s1 [$win sash coord 1]
685 if {$w < 60} {
@@ -710,7 +710,7 @@ proc resizeclistpanes {win w} {
710
711 proc resizecdetpanes {win w} {
712 global oldwidth
713 - if [info exists oldwidth($win)] {
713 + if {[info exists oldwidth($win)]} {
714 set s0 [$win sash coord 0]
715 if {$w < 60} {
716 set sash0 [expr {int($w*3/4 - 2)}]
@@ -768,7 +768,7 @@ proc assigncolor {id} {
768 global parents nparents children nchildren
769 global cornercrossings crossings
770
771 - if [info exists colormap($id)] return
771 + if {[info exists colormap($id)]} return
772 set ncolors [llength $colors]
773 if {$nparents($id) <= 1 && $nchildren($id) == 1} {
774 set child [lindex $children($id) 0]
@@ -2912,7 +2912,9 @@ proc gettreediffs {ids} {
2912 global treediff parents treepending
2913 set treepending $ids
2914 set treediff {}
2915 - if [catch {set gdtf [open [concat | git-diff-tree --no-commit-id -r $ids] r]}] return
2915 + if {[catch \
2916 + {set gdtf [open [concat | git-diff-tree --no-commit-id -r $ids] r]} \
2917 + ]} return
2918 fconfigure $gdtf -blocking 0
2919 fileevent $gdtf readable [list gettreediffline $gdtf $ids]
2920 }