Skip to content

Commit

Permalink
gitk: Fallback to selecting the head commit upon load
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Gavrilov authored and Paul Mackerras committed Jul 31, 2008
1 parent 567c34e commit 835e62a
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,15 @@ proc chewcommits {} {
global numcommits startmsecs

if {[info exists pending_select]} {
set row [first_real_row]
selectline $row 1
update
reset_pending_select {}

if {[commitinview $pending_select $curview]} {
selectline [rowofcommit $pending_select] 1
} else {
set row [first_real_row]
selectline $row 1
}
}
if {$commitidx($curview) > 0} {
#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
Expand Down Expand Up @@ -3372,14 +3379,18 @@ proc showview {n} {
drawvisible
if {$row ne {}} {
selectline $row 0
} elseif {$mainheadid ne {} && [commitinview $mainheadid $curview]} {
selectline [rowofcommit $mainheadid] 1
} elseif {!$viewcomplete($n)} {
reset_pending_select $selid
} else {
set row [first_real_row]
if {$row < $numcommits} {
selectline $row 0
reset_pending_select {}

if {[commitinview $pending_select $curview]} {
selectline [rowofcommit $pending_select] 1
} else {
set row [first_real_row]
if {$row < $numcommits} {
selectline $row 0
}
}
}
if {!$viewcomplete($n)} {
Expand Down

0 comments on commit 835e62a

Please sign in to comment.