git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael Rappazzo <rappazzo@gmail.com>
Date
Mar 18, 2016, 18:51 UTC
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 <rappazzo@gmail.com>
---
 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 -<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.4
Previous: Paul MackerrasNext: Paul Mackerras
Message 4 of 5 in “gitk: changes for the "Tags and heads" view”
  1. 0/2 gitk: changes for the "Tags and heads" viewMichael Rappazzo, Mar 18, 2016
  2. 1/2 gitk: alter the ordering for the "Tags and heads" viewMichael Rappazzo, Mar 18, 2016
  3. Paul MackerrasMar 19, 2016
  4. 2/2 gitk: add an option to enable sorting the "Tags and heads" view by ref typeMichael Rappazzo, Mar 18, 2016
  5. Paul MackerrasMar 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.