[PATCH 2/2] gitk: add an option to enable sorting the "Tags and heads" view by ref type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michael Rappazzo <rappazzo@xxxxxxxxx>
---
 gitk | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 32fbc50..c933233 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 -<n>
 		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.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]