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>

Michael Rappazzo committed Jun 1, 2015 at 11:05 UTC aa1a3e09930012abcb3f6c41a612425e03384e4d
1 file changed +27 -10
gitk
+27 -10
@@ -10308,39 +10308,56 @@ proc refill_reflist {} {
10308 global curview
10309
10310 if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
10311 - set refs {}
10311 + set localrefs {}
10312 + set remoterefs {}
10313 + set tagrefs {}
10314 + set otherrefs {}
10315 +
10316 foreach n [array names headids] {
10313 - if {[string match $reflistfilter $n]} {
10317 + if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
10318 if {[commitinview $headids($n) $curview]} {
10315 - if {[string match "remotes/*" $n]} {
10316 - lappend refs [list $n R]
10317 - } else {
10318 - lappend refs [list $n H]
10319 - }
10319 + lappend localrefs [list $n H]
10320 } else {
10321 interestedin $headids($n) {run refill_reflist}
10322 }
10323 }
10324 }
10325 + set localrefs [lsort -index 0 $localrefs]
10326 +
10327 + foreach n [array names headids] {
10328 + if {[string match "remotes/*" $n] && [string match $reflistfilter $n]} {
10329 + if {[commitinview $headids($n) $curview]} {
10330 + lappend remoterefs [list $n R]
10331 + } else {
10332 + interestedin $headids($n) {run refill_reflist}
10333 + }
10334 + }
10335 + }
10336 + set remoterefs [lsort -index 0 $remoterefs]
10337 +
10338 foreach n [array names tagids] {
10339 if {[string match $reflistfilter $n]} {
10340 if {[commitinview $tagids($n) $curview]} {
10328 - lappend refs [list $n T]
10341 + lappend tagrefs [list $n T]
10342 } else {
10343 interestedin $tagids($n) {run refill_reflist}
10344 }
10345 }
10346 }
10347 + set tagrefs [lsort -index 0 $tagrefs]
10348 +
10349 foreach n [array names otherrefids] {
10350 if {[string match $reflistfilter $n]} {
10351 if {[commitinview $otherrefids($n) $curview]} {
10337 - lappend refs [list $n o]
10352 + lappend otherrefs [list "$n" o]
10353 } else {
10354 interestedin $otherrefids($n) {run refill_reflist}
10355 }
10356 }
10357 }
10343 - set refs [lsort -index 0 $refs]
10358 + set otherrefs [lsort -index 0 $otherrefs]
10359 + set refs [concat $localrefs $remoterefs $tagrefs $otherrefs]
10360 +
10361 if {$refs eq $reflist} return
10362
10363 # Update the contents of $showrefstop.list according to the