Skip to content

Commit 561d038

Browse files
committed
gitk: Fix some bugs in the new cherry-picking code
When inserting the new commit row for the cherry-picked commit, we weren't advancing the selected line (if there is one), and we weren't updating commitlisted properly.
1 parent d1e4675 commit 561d038

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gitk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,14 +3314,14 @@ proc finishcommits {} {
33143314
catch {unset pending_select}
33153315
}
33163316

3317-
# Inserting a new commit as the child of the commit on row $row.
3317+
# Insert a new commit as the child of the commit on row $row.
33183318
# The new commit will be displayed on row $row and the commits
33193319
# on that row and below will move down one row.
33203320
proc insertrow {row newcmit} {
33213321
global displayorder parentlist childlist commitlisted
33223322
global commitrow curview rowidlist rowoffsets numcommits
33233323
global rowrangelist idrowranges rowlaidout rowoptim numcommits
3324-
global linesegends
3324+
global linesegends selectedline
33253325

33263326
if {$row >= $numcommits} {
33273327
puts "oops, inserting new row $row but only have $numcommits rows"
@@ -3334,6 +3334,7 @@ proc insertrow {row newcmit} {
33343334
lappend kids $newcmit
33353335
lset childlist $row $kids
33363336
set childlist [linsert $childlist $row {}]
3337+
set commitlisted [linsert $commitlisted $row 1]
33373338
set l [llength $displayorder]
33383339
for {set r $row} {$r < $l} {incr r} {
33393340
set id [lindex $displayorder $r]
@@ -3409,6 +3410,9 @@ proc insertrow {row newcmit} {
34093410
incr rowoptim
34103411
incr numcommits
34113412

3413+
if {[info exists selectedline] && $selectedline >= $row} {
3414+
incr selectedline
3415+
}
34123416
redisplay
34133417
}
34143418

0 commit comments

Comments
 (0)