gitk: Fallback to selecting the head commit upon load
Try selecting the head, if the previously selected commit is not available in the new view. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:

committed by
Paul Mackerras

parent
567c34e0ed
commit
835e62aef8
15
gitk
15
gitk
@ -1506,9 +1506,16 @@ proc chewcommits {} {
|
|||||||
global numcommits startmsecs
|
global numcommits startmsecs
|
||||||
|
|
||||||
if {[info exists pending_select]} {
|
if {[info exists pending_select]} {
|
||||||
|
update
|
||||||
|
reset_pending_select {}
|
||||||
|
|
||||||
|
if {[commitinview $pending_select $curview]} {
|
||||||
|
selectline [rowofcommit $pending_select] 1
|
||||||
|
} else {
|
||||||
set row [first_real_row]
|
set row [first_real_row]
|
||||||
selectline $row 1
|
selectline $row 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if {$commitidx($curview) > 0} {
|
if {$commitidx($curview) > 0} {
|
||||||
#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
|
#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
|
||||||
#puts "overall $ms ms for $numcommits commits"
|
#puts "overall $ms ms for $numcommits commits"
|
||||||
@ -3372,16 +3379,20 @@ proc showview {n} {
|
|||||||
drawvisible
|
drawvisible
|
||||||
if {$row ne {}} {
|
if {$row ne {}} {
|
||||||
selectline $row 0
|
selectline $row 0
|
||||||
} elseif {$mainheadid ne {} && [commitinview $mainheadid $curview]} {
|
|
||||||
selectline [rowofcommit $mainheadid] 1
|
|
||||||
} elseif {!$viewcomplete($n)} {
|
} elseif {!$viewcomplete($n)} {
|
||||||
reset_pending_select $selid
|
reset_pending_select $selid
|
||||||
|
} else {
|
||||||
|
reset_pending_select {}
|
||||||
|
|
||||||
|
if {[commitinview $pending_select $curview]} {
|
||||||
|
selectline [rowofcommit $pending_select] 1
|
||||||
} else {
|
} else {
|
||||||
set row [first_real_row]
|
set row [first_real_row]
|
||||||
if {$row < $numcommits} {
|
if {$row < $numcommits} {
|
||||||
selectline $row 0
|
selectline $row 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if {!$viewcomplete($n)} {
|
if {!$viewcomplete($n)} {
|
||||||
if {$numcommits == 0} {
|
if {$numcommits == 0} {
|
||||||
show_status [mc "Reading commits..."]
|
show_status [mc "Reading commits..."]
|
||||||
|
Reference in New Issue
Block a user