aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rappazzo <rappazzo@gmail.com>2015-06-01 11:05:25 -0400
committerJohannes Sixt <j6t@kdbg.org>2025-07-20 10:09:34 +0200
commitaa1a3e09930012abcb3f6c41a612425e03384e4d (patch)
tree4f8ba0419dd873028190cc8e8f50296ea770a460
parent8e34d8b1485743221d9a4068a89af8efc97c1d7b (diff)
downloadgit-aa1a3e09930012abcb3f6c41a612425e03384e4d.tar.gz
gitk: sort by ref type on the 'tags and heads' view
In the 'tags and heads' view, the list of refs was globally sorted, which caused the local ref list to be split around other ref list types. This change re-orders the view to be: local refs, remote refs, tags, and then other refs. Signed-off-by: Michael Rappazzo <rappazzo@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
-rwxr-xr-xgitk37
1 files changed, 27 insertions, 10 deletions
diff --git a/gitk b/gitk
index 0df4eee733..911fa63089 100755
--- a/gitk
+++ b/gitk
@@ -10308,39 +10308,56 @@ proc refill_reflist {} {
global curview
if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
- set refs {}
+ set localrefs {}
+ set remoterefs {}
+ set tagrefs {}
+ set otherrefs {}
+
foreach n [array names headids] {
- if {[string match $reflistfilter $n]} {
+ if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
if {[commitinview $headids($n) $curview]} {
- if {[string match "remotes/*" $n]} {
- lappend refs [list $n R]
- } else {
- lappend refs [list $n H]
- }
+ lappend localrefs [list $n H]
} else {
interestedin $headids($n) {run refill_reflist}
}
}
}
+ set localrefs [lsort -index 0 $localrefs]
+
+ foreach n [array names headids] {
+ if {[string match "remotes/*" $n] && [string match $reflistfilter $n]} {
+ if {[commitinview $headids($n) $curview]} {
+ lappend remoterefs [list $n R]
+ } else {
+ interestedin $headids($n) {run refill_reflist}
+ }
+ }
+ }
+ set remoterefs [lsort -index 0 $remoterefs]
+
foreach n [array names tagids] {
if {[string match $reflistfilter $n]} {
if {[commitinview $tagids($n) $curview]} {
- lappend refs [list $n T]
+ lappend tagrefs [list $n T]
} else {
interestedin $tagids($n) {run refill_reflist}
}
}
}
+ set tagrefs [lsort -index 0 $tagrefs]
+
foreach n [array names otherrefids] {
if {[string match $reflistfilter $n]} {
if {[commitinview $otherrefids($n) $curview]} {
- lappend refs [list $n o]
+ lappend otherrefs [list "$n" o]
} else {
interestedin $otherrefids($n) {run refill_reflist}
}
}
}
- set refs [lsort -index 0 $refs]
+ set otherrefs [lsort -index 0 $otherrefs]
+ set refs [concat $localrefs $remoterefs $tagrefs $otherrefs]
+
if {$refs eq $reflist} return
# Update the contents of $showrefstop.list according to the