git-gui: Sort tags descending by tagger date

When trying to create a branch from a tag most people are looking
for a recent tag, not one that is ancient history.  Rather than
sorting tags by their string we now sort them by taggerdate, as
this places the recent tags at the top of the list and the very
old ones at the end.  Tag date works nicely as an approximation
of the actual history order of commits.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2007-07-05 00:07:11 -04:00
parent 7618e6b1c1
commit 560eddc00c

View File

@ -21,14 +21,13 @@ proc load_all_heads {} {
proc load_all_tags {} { proc load_all_tags {} {
set all_tags [list] set all_tags [list]
set fd [open "| git for-each-ref --format=%(refname) refs/tags" r] set fd [open "| git for-each-ref --sort=-taggerdate --format=%(refname) refs/tags" r]
while {[gets $fd line] > 0} { while {[gets $fd line] > 0} {
if {![regsub ^refs/tags/ $line {} name]} continue if {![regsub ^refs/tags/ $line {} name]} continue
lappend all_tags $name lappend all_tags $name
} }
close $fd close $fd
return $all_tags
return [lsort $all_tags]
} }
proc populate_branch_menu {} { proc populate_branch_menu {} {