aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rappazzo <rappazzo@gmail.com>2025-09-13 07:31:51 -0400
committerJohannes Sixt <j6t@kdbg.org>2025-09-14 20:18:30 +0200
commit88189dd7cb535486b74bcf50997253797f4b999c (patch)
treee58b685dda6de820e2610f9b35a8bfd02fe03a25
parent9965cc771b6b43a8852a4950a196180f2c616891 (diff)
downloadgit-88189dd7cb535486b74bcf50997253797f4b999c.tar.gz
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 <rappazzo@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
-rwxr-xr-xgitk4
1 files changed, 3 insertions, 1 deletions
diff --git a/gitk b/gitk
index 080192820e..fc502fbd68 100755
--- a/gitk
+++ b/gitk
@@ -10332,7 +10332,9 @@ proc refill_reflist {} {
if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
if {[commitinview $headids($n) $curview]} {
lappend localrefs [list $n H]
- if {[info exists upstreamofref($n)] && [commitinview $headids($upstreamofref($n)) $curview]} {
+ if {[info exists upstreamofref($n)] && \
+ [info exists headids($upstreamofref($n))] && \
+ [commitinview $headids($upstreamofref($n)) $curview]} {
lappend trackedremoterefs [list $upstreamofref($n) R]
}
} else {