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

[PATCH v3 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 27, 2016, 15:06 UTC
Message-ID
<1459091168-46908-3-git-send-email-rappazzo@gmail.com>
In-Reply-To
<1459091168-46908-1-git-send-email-rappazzo@gmail.com>
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
---
 gitk | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/gitk b/gitk
index 3686370..29ef36c 100755
--- a/gitk
+++ b/gitk
@@ -9944,7 +9944,7 @@ proc reflistfilter_change {n1 n2 op} {
 }
 
 proc refill_reflist {} {
-    global reflist reflistfilter showrefstop headids tagids otherrefids localrefs_tracking_remotes
+    global reflist reflistfilter showrefstop headids tagids otherrefids localrefs_tracking_remotes sortrefsbytype
     global curview
 
     if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
@@ -10004,6 +10004,10 @@ proc refill_reflist {} {
     }
     set otherrefs [lsort -index 0 $otherrefs]
     lappend refs {*}$localrefs {*}$locally_tracked_remote_refs {*}$remoterefs {*}$tagrefs {*}$otherrefs
+    if {$sortrefsbytype ne 1} {
+       set refs [lsort -index 0 $refs]
+    }
+
     if {$refs eq $reflist} return
 
     # Update the contents of $showrefstop.list according to the
@@ -11416,7 +11420,7 @@ proc create_prefs_page {w} {
 proc prefspage_general {notebook} {
     global NS maxwidth maxgraphpct showneartags showlocalchanges
     global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
-    global hideremotes want_ttk have_ttk maxrefs
+    global hideremotes want_ttk have_ttk maxrefs sortrefsbytype
 
     set page [create_prefs_page $notebook.general]
 
@@ -11440,6 +11444,9 @@ proc prefspage_general {notebook} {
     ${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \
 	-variable hideremotes
     grid x $page.hideremotes -sticky w
+    ${NS}::checkbutton $page.sortrefsbytype -text [mc "Sort refs by type"] \
+	-variable sortrefsbytype
+    grid x $page.sortrefsbytype -sticky w
 
     ${NS}::label $page.ddisp -text [mc "Diff display options"]
     grid $page.ddisp - -sticky w -pady 10
@@ -11544,7 +11551,7 @@ proc doprefs {} {
     global oldprefs prefstop showneartags showlocalchanges
     global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
     global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
-    global hideremotes want_ttk have_ttk
+    global hideremotes want_ttk have_ttk sortrefsbytype
 
     set top .gitkprefs
     set prefstop $top
@@ -11553,7 +11560,8 @@ proc doprefs {} {
 	return
     }
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-		   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+		   limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+		   sortrefsbytype} {
 	set oldprefs($v) [set $v]
     }
     ttk_toplevel $top
@@ -11679,7 +11687,8 @@ proc prefscan {} {
     global oldprefs prefstop
 
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-		   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+		   limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+		   sortrefsbytype} {
 	global $v
 	set $v $oldprefs($v)
     }
@@ -12215,6 +12224,7 @@ set showneartags 1
 set hideremotes 0
 set maxrefs 20
 set visiblerefs {"master"}
+set sortrefsbytype 0
 set maxlinelen 200
 set showlocalchanges 1
 set limitdiffs 1
@@ -12318,6 +12328,7 @@ set config_variables {
     filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
     linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
     indexcirclecolor circlecolors linkfgcolor circleoutlinecolor
+    sortrefsbytype
 }
 foreach var $config_variables {
     config_init_trace $var
-- 
2.7.4
Previous: Paul MackerrasNext: Mike Rappazzo
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 27, 2016
  2. 1/2 gitk: alter the ordering for the "Tags and heads" viewMichael Rappazzo, Mar 27, 2016
  3. Paul MackerrasDec 11, 2016
  4. 2/2 gitk: add an option to enable sorting the "Tags and heads" view by ref typeMichael Rappazzo, Mar 27, 2016
  5. Mike RappazzoApr 28, 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.