diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /lib/gitlab/tree_summary.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'lib/gitlab/tree_summary.rb')
-rw-r--r-- | lib/gitlab/tree_summary.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/tree_summary.rb b/lib/gitlab/tree_summary.rb index bc7b8bd2b94..86cd91f0a32 100644 --- a/lib/gitlab/tree_summary.rb +++ b/lib/gitlab/tree_summary.rb @@ -104,12 +104,12 @@ module Gitlab end def fetch_last_cached_commits_list - cache_key = ['projects', project.id, 'last_commits_list', commit.id, ensured_path, offset, limit] + cache_key = ['projects', project.id, 'last_commits', commit.id, ensured_path, offset, limit] commits = Rails.cache.fetch(cache_key, expires_in: CACHE_EXPIRE_IN) do repository .list_last_commits_for_tree(commit.id, ensured_path, offset: offset, limit: limit, literal_pathspec: true) - .transform_values!(&:to_hash) + .transform_values! { |commit| commit_to_hash(commit) } end commits.transform_values! { |value| Commit.from_hash(value, project) } @@ -121,6 +121,12 @@ module Gitlab resolved_commits[commit.id] ||= commit end + def commit_to_hash(commit) + commit.to_hash.tap do |hash| + hash[:message] = hash[:message].to_s.truncate_bytes(1.kilobyte, omission: '...') + end + end + def commit_path(commit) Gitlab::Routing.url_helpers.project_commit_path(project, commit) end |