BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c75f1d3d
Commit
c75f1d3d
authored
May 17, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-tree-last-commit' into 'master'
Show last commit for current tree on tree page See merge request !11442
parents
319cab41
afef4a66
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
6 deletions
+25
-6
blob_controller.rb
app/controllers/projects/blob_controller.rb
+2
-0
tree_controller.rb
app/controllers/projects/tree_controller.rb
+2
-0
_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-2
show.html.haml
app/views/projects/tree/show.html.haml
+1
-1
dm-tree-last-commit.yml
changelogs/unreleased/dm-tree-last-commit.yml
+4
-0
browse_files_spec.rb
spec/features/projects/files/browse_files_spec.rb
+12
-0
show.html.haml_spec.rb
spec/views/projects/tree/show.html.haml_spec.rb
+3
-3
No files found.
app/controllers/projects/blob_controller.rb
View file @
c75f1d3d
...
...
@@ -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
...
...
app/controllers/projects/tree_controller.rb
View file @
c75f1d3d
...
...
@@ -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
...
...
app/views/projects/blob/_blob.html.haml
View file @
c75f1d3d
...
...
@@ -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
...
...
app/views/projects/tree/show.html.haml
View file @
c75f1d3d
...
...
@@ -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
changelogs/unreleased/dm-tree-last-commit.yml
0 → 100644
View file @
c75f1d3d
---
title
:
Show last commit for current tree on tree page
merge_request
:
author
:
spec/features/projects/files/browse_files_spec.rb
View file @
c75f1d3d
...
...
@@ -31,4 +31,16 @@ feature 'user browses project', feature: true, js: true do
expect
(
page
).
to
have_content
'oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
expect
(
page
).
to
have_content
'size 1575078'
end
scenario
'can see last commit for current directory'
do
last_commit
=
project
.
repository
.
last_commit_for_path
(
project
.
default_branch
,
'files'
)
click_link
'files'
wait_for_ajax
page
.
within
(
'.blob-commit-info'
)
do
expect
(
page
).
to
have_content
last_commit
.
short_id
expect
(
page
).
to
have_content
last_commit
.
author_name
end
end
end
spec/views/projects/tree/show.html.haml_spec.rb
View file @
c75f1d3d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment