From: Michael Rappazzo Date: Fri, 18 Mar 2016 18:51:37 GMT Subject: [PATCH v2 2/2] gitk: add an option to enable sorting the "Tags and heads" view by ref type Message-ID: <1458327097-92126-3-git-send-email-rappazzo@gmail.com> In-Reply-To: <1458327097-92126-1-git-send-email-rappazzo@gmail.com> Signed-off-by: Michael Rappazzo --- gitk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gitk b/gitk index d6d3136..6d376e3 100755 --- a/gitk +++ b/gitk @@ -158,6 +158,7 @@ proc parseviewargs {n arglist} { global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env global vinlinediff global worddiff git_version + global sort_refs_by_type set vdatemode($n) 0 set vmergeonly($n) 0 @@ -170,6 +171,7 @@ proc parseviewargs {n arglist} { set allknown 1 set filtered 0 set i -1 + set sort_refs_by_type "0" foreach arg $arglist { incr i if {$nextisval} { @@ -261,6 +263,9 @@ proc parseviewargs {n arglist} { "--no-replace-objects" { set env(GIT_NO_REPLACE_OBJECTS) "1" } + "--sort-refs-by-type" { + set sort_refs_by_type "1" + } "-*" { # Other flag arguments including - if {[string is digit -strict [string range $arg 1 end]]} { @@ -9929,7 +9934,7 @@ proc reflistfilter_change {n1 n2 op} { } proc refill_reflist {} { - global reflist reflistfilter showrefstop headids tagids otherrefids + global reflist reflistfilter showrefstop headids tagids otherrefids sort_refs_by_type global curview if {![info exists showrefstop] || ![winfo exists $showrefstop]} return @@ -9998,6 +10003,10 @@ proc refill_reflist {} { } set otherrefs [lsort -index 0 $otherrefs] lappend refs {*}$localrefs {*}$locally_tracked_remote_refs {*}$remoterefs {*}$tagrefs {*}$otherrefs + if {$sort_refs_by_type ne "1"} { + set refs [lsort -index 0 $refs] + } + if {$refs eq $reflist} return # Update the contents of $showrefstop.list according to the -- 2.7.4