Commit 2c1d5d12 authored by Robert May's avatar Robert May

Reduced instantiations in loop

Lowers the number of variables instantiated when sorting a
potentially very large set of tags.
parent afcb3d3f
...@@ -1165,17 +1165,13 @@ class Repository ...@@ -1165,17 +1165,13 @@ class Repository
end end
def tags_sorted_by_committed_date def tags_sorted_by_committed_date
tags.sort_by do |tag|
# Annotated tags can point to any object (e.g. a blob), but generally # Annotated tags can point to any object (e.g. a blob), but generally
# tags point to a commit. If we don't have a commit, then just default # tags point to a commit. If we don't have a commit, then just default
# to putting the tag at the end of the list. # to putting the tag at the end of the list.
target = tag.dereferenced_target default = Time.current
if target tags.sort_by do |tag|
target.committed_date tag.dereferenced_target&.committed_date || default
else
Time.current
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment