From: Michael Rappazzo Date: Mon, 1 Jun 2015 15:05:25 +0000 (-0400) Subject: gitk: sort by ref type on the 'tags and heads' view X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa1a3e09930012abcb3f6c41a612425e03384e4d;p=thirdparty%2Fgit.git 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 Signed-off-by: Johannes Sixt --- 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