Skip to content

Commit 88189dd

Browse files
rappazzoj6t
authored andcommitted
gitk: fix error when remote tracking branch is deleted
When a remote tracking branch is deleted (e.g., via 'git push --delete origin branch'), the headids array entry for that branch is removed, but upstreamofref may still reference it. This causes gitk to show an error and prevents the Tags and Heads view from opening. Fix by checking that headids($upstreamofref($n)) exists before accessing it in the refill_reflist function. Signed-off-by: Michael Rappazzo <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent 9965cc7 commit 88189dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10332,7 +10332,9 @@ proc refill_reflist {} {
1033210332
if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
1033310333
if {[commitinview $headids($n) $curview]} {
1033410334
lappend localrefs [list $n H]
10335-
if {[info exists upstreamofref($n)] && [commitinview $headids($upstreamofref($n)) $curview]} {
10335+
if {[info exists upstreamofref($n)] && \
10336+
[info exists headids($upstreamofref($n))] && \
10337+
[commitinview $headids($upstreamofref($n)) $curview]} {
1033610338
lappend trackedremoterefs [list $upstreamofref($n) R]
1033710339
}
1033810340
} else {

0 commit comments

Comments
 (0)