From b28119551bc06986bdc9048ee30393b6b9b20c5f Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 29 Jul 2025 14:52:54 +0200 Subject: [PATCH 1/2] gitk: avoid duplicated upstream refs It is possible that multiple local branches track the same upstream. In this case, the refs dialog lists the tracked upstream branch multiple times. This is undesirable. Make them unique. Signed-off-by: Johannes Sixt --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index 38c2c81a79..b31d0b0a63 100755 --- a/gitk +++ b/gitk @@ -10340,7 +10340,7 @@ proc refill_reflist {} { } } } - set trackedremoterefs [lsort -index 0 $trackedremoterefs] + set trackedremoterefs [lsort -index 0 -unique $trackedremoterefs] set localrefs [lsort -index 0 $localrefs] foreach n [array names headids] { From 9965cc771b6b43a8852a4950a196180f2c616891 Mon Sep 17 00:00:00 2001 From: Michael Rappazzo Date: Thu, 31 Jul 2025 07:53:21 -0400 Subject: [PATCH 2/2] gitk: filter invisible upstream refs from reference list In refill_reflist, upstream refs are now only included if their commits are visible in the current view. This prevents display issues like multiple highlighted branches when clicking entries. Signed-off-by: Michael Rappazzo --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index b31d0b0a63..080192820e 100755 --- a/gitk +++ b/gitk @@ -10332,7 +10332,7 @@ 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)]} { + if {[info exists upstreamofref($n)] && [commitinview $headids($upstreamofref($n)) $curview]} { lappend trackedremoterefs [list $upstreamofref($n) R] } } else {