Commit d780b8ba authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'further-tags-improvements' into 'master'

Minor memory usage improvements on tags

See merge request gitlab-org/gitlab!60641
parents 3bd38acc 2c1d5d12
......@@ -1165,17 +1165,13 @@ class Repository
end
def tags_sorted_by_committed_date
tags.sort_by do |tag|
# 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
# to putting the tag at the end of the list.
target = tag.dereferenced_target
# 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
# to putting the tag at the end of the list.
default = Time.current
if target
target.committed_date
else
Time.current
end
tags.sort_by do |tag|
tag.dereferenced_target&.committed_date || default
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