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>
This commit is contained in:
Michael Rappazzo 2015-06-01 11:05:25 -04:00 committed by Johannes Sixt
parent 8e34d8b148
commit aa1a3e0993

37
gitk
View File

@ -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