@@ -296,7 +296,7 @@ proc start_rev_list {view} {
296
296
global startmsecs commitidx viewcomplete curview
297
297
global commfd leftover tclencoding
298
298
global viewargs viewargscmd viewfiles vfilelimit
299
- global showlocalchanges commitinterest mainheadid
299
+ global showlocalchanges commitinterest
300
300
global viewactive loginstance viewinstances vmergeonly
301
301
global pending_select mainheadid
302
302
global vcanopt vflags vrevs vorigargs
@@ -358,7 +358,7 @@ proc start_rev_list {view} {
358
358
set viewinstances($view ) [list $i ]
359
359
set commfd($i ) $fd
360
360
set leftover($i ) {}
361
- if {$showlocalchanges } {
361
+ if {$showlocalchanges && $mainheadid ne {} } {
362
362
lappend commitinterest($mainheadid ) {dodiffindex}
363
363
}
364
364
fconfigure $fd -blocking 0 -translation lf -eofchar {}
@@ -406,7 +406,7 @@ proc getcommits {} {
406
406
407
407
proc updatecommits {} {
408
408
global curview vcanopt vorigargs vfilelimit viewinstances
409
- global viewactive viewcomplete loginstance tclencoding mainheadid
409
+ global viewactive viewcomplete loginstance tclencoding
410
410
global startmsecs commfd showneartags showlocalchanges leftover
411
411
global mainheadid pending_select
412
412
global isworktree
@@ -1467,7 +1467,6 @@ proc chewcommits {} {
1467
1467
if {$viewcomplete($curview) } {
1468
1468
global commitidx varctok
1469
1469
global numcommits startmsecs
1470
- global mainheadid nullid
1471
1470
1472
1471
if {[info exists pending_select]} {
1473
1472
set row [first_real_row]
@@ -1604,12 +1603,10 @@ proc readrefs {} {
1604
1603
set mainhead {}
1605
1604
set mainheadid {}
1606
1605
catch {
1606
+ set mainheadid [exec git rev-parse HEAD]
1607
1607
set thehead [exec git symbolic-ref HEAD]
1608
1608
if {[string match " refs/heads/*" $thehead ]} {
1609
1609
set mainhead [string range $thehead 11 end]
1610
- if {[info exists headids($mainhead )]} {
1611
- set mainheadid $headids($mainhead)
1612
- }
1613
1610
}
1614
1611
}
1615
1612
}
@@ -4022,6 +4019,7 @@ proc layoutmore {} {
4022
4019
proc doshowlocalchanges {} {
4023
4020
global curview mainheadid
4024
4021
4022
+ if {$mainheadid eq {}} return
4025
4023
if {[commitinview $mainheadid $curview ]} {
4026
4024
dodiffindex
4027
4025
} else {
@@ -4841,16 +4839,19 @@ proc drawcmittext {id row col} {
4841
4839
global cmitlisted commitinfo rowidlist parentlist
4842
4840
global rowtextx idpos idtags idheads idotherrefs
4843
4841
global linehtag linentag linedtag selectedline
4844
- global canvxmax boldrows boldnamerows fgcolor nullid nullid2
4842
+ global canvxmax boldrows boldnamerows fgcolor
4843
+ global mainheadid nullid nullid2 circleitem circlecolors
4845
4844
4846
4845
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
4847
4846
set listed $cmitlisted($curview,$id)
4848
4847
if {$id eq $nullid } {
4849
4848
set ofill red
4850
4849
} elseif {$id eq $nullid2 } {
4851
4850
set ofill green
4851
+ } elseif {$id eq $mainheadid } {
4852
+ set ofill yellow
4852
4853
} else {
4853
- set ofill [expr { $listed != 0 ? $listed == 2 ? " gray " : " blue " : " white " } ]
4854
+ set ofill [lindex $circlecolors $listed ]
4854
4855
}
4855
4856
set x [xc $row $col ]
4856
4857
set y [yc $row ]
@@ -4874,6 +4875,7 @@ proc drawcmittext {id row col} {
4874
4875
[expr {$x - $orad }] [expr {$y + $orad - 1}] \
4875
4876
-fill $ofill -outline $fgcolor -width 1 -tags circle]
4876
4877
}
4878
+ set circleitem($row ) $t
4877
4879
$canv raise $t
4878
4880
$canv bind $t <1> {selcanvline {} %x %y}
4879
4881
set rmx [llength [lindex $rowidlist $row ]]
@@ -7399,12 +7401,18 @@ proc domktag {} {
7399
7401
}
7400
7402
7401
7403
proc redrawtags {id} {
7402
- global canv linehtag idpos currentid curview
7403
- global canvxmax iddrawn
7404
+ global canv linehtag idpos currentid curview cmitlisted
7405
+ global canvxmax iddrawn circleitem mainheadid circlecolors
7404
7406
7405
7407
if {![commitinview $id $curview ]} return
7406
7408
if {![info exists iddrawn($id )]} return
7407
7409
set row [rowofcommit $id ]
7410
+ if {$id eq $mainheadid } {
7411
+ set ofill yellow
7412
+ } else {
7413
+ set ofill [lindex $circlecolors $cmitlisted($curview,$id) ]
7414
+ }
7415
+ $canv itemconf $circleitem($row) -fill $ofill
7408
7416
$canv delete tag.$id
7409
7417
set xt [eval drawtags $id $idpos($id) ]
7410
7418
$canv coords $linehtag($row) $xt [lindex $idpos($id) 2]
@@ -7574,8 +7582,8 @@ proc cherrypick {} {
7574
7582
if {$mainhead ne {}} {
7575
7583
movehead $newhead $mainhead
7576
7584
movedhead $newhead $mainhead
7577
- set mainheadid $newhead
7578
7585
}
7586
+ set mainheadid $newhead
7579
7587
redrawtags $oldhead
7580
7588
redrawtags $newhead
7581
7589
selbyid $newhead
@@ -7675,7 +7683,7 @@ proc headmenu {x y id head} {
7675
7683
}
7676
7684
7677
7685
proc cobranch {} {
7678
- global headmenuid headmenuhead mainhead headids
7686
+ global headmenuid headmenuhead headids
7679
7687
global showlocalchanges mainheadid
7680
7688
7681
7689
# check the tree is clean first??
@@ -7711,12 +7719,10 @@ proc readcheckoutstat {fd newhead newheadid} {
7711
7719
if {[catch {close $fd } err]} {
7712
7720
error_popup $err
7713
7721
}
7714
- set oldmainhead $mainhead
7722
+ set oldmainid $mainheadid
7715
7723
set mainhead $newhead
7716
7724
set mainheadid $newheadid
7717
- if {[info exists headids($oldmainhead )]} {
7718
- redrawtags $headids($oldmainhead)
7719
- }
7725
+ redrawtags $oldmainid
7720
7726
redrawtags $newheadid
7721
7727
selbyid $newheadid
7722
7728
if {$showlocalchanges } {
@@ -9016,12 +9022,14 @@ proc rereadrefs {} {
9016
9022
[array names idheads] [array names idotherrefs]]]
9017
9023
foreach id $refids {
9018
9024
set v [listrefs $id ]
9019
- if {![info exists ref($id )] || $ref($id) != $v ||
9020
- ($id eq $oldmainhead && $id ne $mainheadid ) ||
9021
- ($id eq $mainheadid && $id ne $oldmainhead )} {
9025
+ if {![info exists ref($id )] || $ref($id) != $v } {
9022
9026
redrawtags $id
9023
9027
}
9024
9028
}
9029
+ if {$oldmainhead ne $mainheadid } {
9030
+ redrawtags $oldmainhead
9031
+ redrawtags $mainheadid
9032
+ }
9025
9033
run refill_reflist
9026
9034
}
9027
9035
@@ -9761,6 +9769,8 @@ set diffcontext 3
9761
9769
set ignorespace 0
9762
9770
set selectbgcolor gray85
9763
9771
9772
+ set circlecolors {white blue gray blue blue}
9773
+
9764
9774
# # For msgcat loading, first locate the installation location.
9765
9775
if { [info exists ::env(GITK_MSGSDIR)] } {
9766
9776
# # Msgsdir was manually set in the environment.
0 commit comments