Skip to content
Snippets Groups Projects
Commit d3b24a76 authored by Douwe Maan's avatar Douwe Maan Committed by Dmitriy Zaporozhets
Browse files

Show last commit for current tree on tree page

parent fb67ea49
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -42,6 +42,8 @@ class Projects::BlobController < Projects::ApplicationController
environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }
@environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last
 
@last_commit = @repository.last_commit_for_path(@commit.id, @blob.path)
render 'show'
end
 
Loading
Loading
Loading
Loading
@@ -24,6 +24,8 @@ class Projects::TreeController < Projects::ApplicationController
end
end
 
@last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
respond_to do |format|
format.html
# Disable cache so browser history works
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@
.info-well.hidden-xs
.well-segment
%ul.blob-commit-info
- blob_commit = @repository.last_commit_for_path(@commit.id, blob.path)
= render blob_commit, project: @project, ref: @ref
= render 'projects/commits/commit', commit: @last_commit, project: @project, ref: @ref
 
- auxiliary_viewer = blob.auxiliary_viewer
- if auxiliary_viewer && !auxiliary_viewer.render_error
Loading
Loading
Loading
Loading
@@ -7,4 +7,4 @@
= render 'projects/last_push'
 
%div{ class: container_class }
= render 'projects/files', commit: @commit, project: @project, ref: @ref
= render 'projects/files', commit: @last_commit, project: @project, ref: @ref
---
title: Show last commit for current tree on tree page
merge_request:
author:
Loading
Loading
@@ -21,11 +21,11 @@ describe 'projects/tree/show' do
let(:tree) { repository.tree(commit.id, path) }
 
before do
assign(:id, File.join(ref, path))
assign(:ref, ref)
assign(:commit, commit)
assign(:id, commit.id)
assign(:tree, tree)
assign(:path, path)
assign(:last_commit, commit)
assign(:tree, tree)
end
 
it 'displays correctly' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment