Skip to content

Commit eb5f8c9

Browse files
committed
gitk: Don't try to show local changes from a head that isn't shown
When updating the display, if the checked-out head has moved on and isn't currently shown, and there are local changes, we could try to insert a fake row with a parent that isn't displayed, leading to a Tcl error. This is because we check whether the checked-out head is displayed before rereading the references (which is when we discover that the head has moved). This fixes it. Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent fc2a256 commit eb5f8c9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

gitk

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,18 @@ proc updatecommits {} {
170170
global curview viewargs viewfiles viewincl viewinstances
171171
global viewactive viewcomplete loginstance tclencoding mainheadid
172172
global varcid startmsecs commfd showneartags showlocalchanges leftover
173+
global mainheadid
173174

174-
if {$showlocalchanges && [commitinview $mainheadid $curview]} {
175-
dodiffindex
176-
}
175+
set oldmainid $mainheadid
177176
rereadrefs
177+
if {$showlocalchanges} {
178+
if {$mainheadid ne $oldmainid} {
179+
dohidelocalchanges
180+
}
181+
if {[commitinview $mainheadid $curview]} {
182+
dodiffindex
183+
}
184+
}
178185
set view $curview
179186
set commits [exec git rev-parse --default HEAD --revs-only \
180187
$viewargs($view)]

0 commit comments

Comments
 (0)