summaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-09-15 09:33:39 +1000
committerPaul Mackerras <paulus@samba.org>2007-09-15 09:33:39 +1000
commit3e6b893f33476e7969c7bd5b8914e8bcc62385e3 (patch)
tree1b1b68d681ca477386999c7eb9169301ce575ca2 /gitk
parentf56782aef4b3d7339461d8f12ff15f6258d9871d (diff)
downloadgit-3e6b893f33476e7969c7bd5b8914e8bcc62385e3.tar.gz
gitk: Get rid of lookingforhead, use commitinterest instead
Now that we have a general-purpose way of taking some action when a commit ID of interest is encountered, use that for triggering the git diff-index process when we find the currently checked-out head, rather than the special-purpose lookingforhead variable. Also do the commitinterest processing in getcommitlines rather than in showstuff. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk42
1 files changed, 17 insertions, 25 deletions
diff --git a/gitk b/gitk
index fd6bbab3ed..85d33abf4a 100755
--- a/gitk
+++ b/gitk
@@ -83,7 +83,7 @@ proc start_rev_list {view} {
global startmsecs
global commfd leftover tclencoding datemode
global viewargs viewfiles commitidx viewcomplete vnextroot
- global lookingforhead showlocalchanges
+ global showlocalchanges commitinterest mainheadid
set startmsecs [clock clicks -milliseconds]
set commitidx($view) 0
@@ -102,7 +102,9 @@ proc start_rev_list {view} {
}
set commfd($view) $fd
set leftover($view) {}
- set lookingforhead $showlocalchanges
+ if {$showlocalchanges} {
+ lappend commitinterest($mainheadid) {dodiffindex}
+ }
fconfigure $fd -blocking 0 -translation lf -eofchar {}
if {$tclencoding != {}} {
fconfigure $fd -encoding $tclencoding
@@ -147,7 +149,7 @@ proc strrep {n} {
}
proc getcommitlines {fd view} {
- global commitlisted
+ global commitlisted commitinterest
global leftover commfd
global displayorder commitidx viewcomplete commitrow commitdata
global parentlist children curview hlview
@@ -303,6 +305,12 @@ proc getcommitlines {fd view} {
lappend vdisporder($view) $id
lappend vcmitlisted($view) $listed
}
+ if {[info exists commitinterest($id)]} {
+ foreach script $commitinterest($id) {
+ eval [string map [list "%I" $id] $script]
+ }
+ unset commitinterest($id)
+ }
set gotsome 1
}
if {$gotsome} {
@@ -2715,7 +2723,7 @@ proc layoutmore {} {
proc showstuff {canshow last} {
global numcommits commitrow pending_select selectedline curview
- global lookingforhead mainheadid displayorder selectfirst
+ global mainheadid displayorder selectfirst
global lastscrollset commitinterest
if {$numcommits == 0} {
@@ -2723,15 +2731,6 @@ proc showstuff {canshow last} {
set phase "incrdraw"
allcanvs delete all
}
- for {set l $numcommits} {$l < $canshow} {incr l} {
- set id [lindex $displayorder $l]
- if {[info exists commitinterest($id)]} {
- foreach script $commitinterest($id) {
- eval [string map [list "%I" $id] $script]
- }
- unset commitinterest($id)
- }
- }
set r0 $numcommits
set prev $numcommits
set numcommits $canshow
@@ -2762,28 +2761,22 @@ proc showstuff {canshow last} {
set selectfirst 0
}
}
- if {$lookingforhead && [info exists commitrow($curview,$mainheadid)]
- && ($last || $commitrow($curview,$mainheadid) < $numcommits - 1)} {
- set lookingforhead 0
- dodiffindex
- }
}
proc doshowlocalchanges {} {
- global lookingforhead curview mainheadid phase commitrow
+ global curview mainheadid phase commitrow
if {[info exists commitrow($curview,$mainheadid)] &&
($phase eq {} || $commitrow($curview,$mainheadid) < $numcommits - 1)} {
dodiffindex
} elseif {$phase ne {}} {
- set lookingforhead 1
+ lappend commitinterest($mainheadid) {}
}
}
proc dohidelocalchanges {} {
- global lookingforhead localfrow localirow lserial
+ global localfrow localirow lserial
- set lookingforhead 0
if {$localfrow >= 0} {
removerow $localfrow
set localfrow -1
@@ -2800,8 +2793,9 @@ proc dohidelocalchanges {} {
# spawn off a process to do git diff-index --cached HEAD
proc dodiffindex {} {
- global localirow localfrow lserial
+ global localirow localfrow lserial showlocalchanges
+ if {!$showlocalchanges} return
incr lserial
set localfrow -1
set localirow -1
@@ -6188,7 +6182,6 @@ proc cherrypick {} {
proc resethead {} {
global mainheadid mainhead rowmenuid confirm_ok resettype
- global showlocalchanges
set confirm_ok 0
set w ".confirmreset"
@@ -8249,7 +8242,6 @@ set cmdlineok 0
set stopped 0
set stuffsaved 0
set patchnum 0
-set lookingforhead 0
set localirow -1
set localfrow -1
set lserial 0