Skip to content

Commit aa1a3e0

Browse files
rappazzoj6t
authored andcommitted
gitk: sort by ref type on the 'tags and heads' view
In the 'tags and heads' view, the list of refs was globally sorted, which caused the local ref list to be split around other ref list types. This change re-orders the view to be: local refs, remote refs, tags, and then other refs. Signed-off-by: Michael Rappazzo <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent 8e34d8b commit aa1a3e0

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

gitk

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10308,39 +10308,56 @@ proc refill_reflist {} {
1030810308
global curview
1030910309
1031010310
if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
10311-
set refs {}
10311+
set localrefs {}
10312+
set remoterefs {}
10313+
set tagrefs {}
10314+
set otherrefs {}
10315+
1031210316
foreach n [array names headids] {
10313-
if {[string match $reflistfilter $n]} {
10317+
if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
1031410318
if {[commitinview $headids($n) $curview]} {
10315-
if {[string match "remotes/*" $n]} {
10316-
lappend refs [list $n R]
10317-
} else {
10318-
lappend refs [list $n H]
10319-
}
10319+
lappend localrefs [list $n H]
1032010320
} else {
1032110321
interestedin $headids($n) {run refill_reflist}
1032210322
}
1032310323
}
1032410324
}
10325+
set localrefs [lsort -index 0 $localrefs]
10326+
10327+
foreach n [array names headids] {
10328+
if {[string match "remotes/*" $n] && [string match $reflistfilter $n]} {
10329+
if {[commitinview $headids($n) $curview]} {
10330+
lappend remoterefs [list $n R]
10331+
} else {
10332+
interestedin $headids($n) {run refill_reflist}
10333+
}
10334+
}
10335+
}
10336+
set remoterefs [lsort -index 0 $remoterefs]
10337+
1032510338
foreach n [array names tagids] {
1032610339
if {[string match $reflistfilter $n]} {
1032710340
if {[commitinview $tagids($n) $curview]} {
10328-
lappend refs [list $n T]
10341+
lappend tagrefs [list $n T]
1032910342
} else {
1033010343
interestedin $tagids($n) {run refill_reflist}
1033110344
}
1033210345
}
1033310346
}
10347+
set tagrefs [lsort -index 0 $tagrefs]
10348+
1033410349
foreach n [array names otherrefids] {
1033510350
if {[string match $reflistfilter $n]} {
1033610351
if {[commitinview $otherrefids($n) $curview]} {
10337-
lappend refs [list $n o]
10352+
lappend otherrefs [list "$n" o]
1033810353
} else {
1033910354
interestedin $otherrefids($n) {run refill_reflist}
1034010355
}
1034110356
}
1034210357
}
10343-
set refs [lsort -index 0 $refs]
10358+
set otherrefs [lsort -index 0 $otherrefs]
10359+
set refs [concat $localrefs $remoterefs $tagrefs $otherrefs]
10360+
1034410361
if {$refs eq $reflist} return
1034510362
1034610363
# Update the contents of $showrefstop.list according to the

0 commit comments

Comments
 (0)