aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rappazzo <michael.rappazzo@infor.com>2025-07-18 16:33:08 -0400
committerJohannes Sixt <j6t@kdbg.org>2025-07-20 10:12:17 +0200
commit9abe70db6cf916e32a4dbbb593cc361cfd67dd65 (patch)
treea0bed38f57c6e5cf377b4b91d13aa38ad00b2f0f
parentgitk: sort by ref type on the 'tags and heads' view (diff)
downloadgit-9abe70db6cf916e32a4dbbb593cc361cfd67dd65.tar.gz
git-9abe70db6cf916e32a4dbbb593cc361cfd67dd65.zip
gitk: make 'sort-refs-by-type' optional and persistent
On the 'tags and heads' view, add an option to enable or disable 'Sort refs by type'. This option is read from and written to the config file. Clicking on the option will update the refs in the view. Signed-off-by: Michael Rappazzo <michael.rappazzo@infor.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
-rwxr-xr-xgitk12
1 files changed, 10 insertions, 2 deletions
diff --git a/gitk b/gitk
index 911fa63089..a22b1bbfc6 100755
--- a/gitk
+++ b/gitk
@@ -10261,6 +10261,9 @@ proc showrefs {} {
pack $top.f.e -side right -fill x -expand 1
pack $top.f.l -side left
grid $top.f - -sticky ew -pady 2
+ ${NS}::checkbutton $top.sort -text [mc "Sort refs by type"] \
+ -variable sortrefsbytype -command {refill_reflist}
+ grid $top.sort - -sticky w -pady 2
${NS}::button $top.close -command [list destroy $top] -text [mc "Close"]
bind $top <Key-Escape> [list destroy $top]
grid $top.close -
@@ -10304,7 +10307,7 @@ proc reflistfilter_change {n1 n2 op} {
}
proc refill_reflist {} {
- global reflist reflistfilter showrefstop headids tagids otherrefids
+ global reflist reflistfilter showrefstop headids tagids otherrefids sortrefsbytype
global curview
if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
@@ -10356,7 +10359,11 @@ proc refill_reflist {} {
}
}
set otherrefs [lsort -index 0 $otherrefs]
+
set refs [concat $localrefs $remoterefs $tagrefs $otherrefs]
+ if {!$sortrefsbytype} {
+ set refs [lsort -index 0 $refs]
+ }
if {$refs eq $reflist} return
@@ -12618,6 +12625,7 @@ set wrapcomment "none"
set wrapdefault "none"
set showneartags 1
set hideremotes 0
+set sortrefsbytype 1
set maxrefs 20
set visiblerefs {"master"}
set maxlinelen 200
@@ -12732,7 +12740,7 @@ set config_variables {
filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors
- web_browser
+ sortrefsbytype web_browser
}
foreach var $config_variables {
config_init_trace $var