Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d3b24a76
Commit
d3b24a76
authored
May 17, 2017
by
Douwe Maan
Committed by
Dmitriy Zaporozhets
May 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show last commit for current tree on tree page
parent
fb67ea49
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
6 deletions
+13
-6
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+2
-0
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+2
-0
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-2
app/views/projects/tree/show.html.haml
app/views/projects/tree/show.html.haml
+1
-1
changelogs/unreleased/dm-tree-last-commit.yml
changelogs/unreleased/dm-tree-last-commit.yml
+4
-0
spec/views/projects/tree/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 @
d3b24a76
...
@@ -42,6 +42,8 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -42,6 +42,8 @@ class Projects::BlobController < Projects::ApplicationController
environment_params
=
@repository
.
branch_exists?
(
@ref
)
?
{
ref:
@ref
}
:
{
commit:
@commit
}
environment_params
=
@repository
.
branch_exists?
(
@ref
)
?
{
ref:
@ref
}
:
{
commit:
@commit
}
@environment
=
EnvironmentsFinder
.
new
(
@project
,
current_user
,
environment_params
).
execute
.
last
@environment
=
EnvironmentsFinder
.
new
(
@project
,
current_user
,
environment_params
).
execute
.
last
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@blob
.
path
)
render
'show'
render
'show'
end
end
...
...
app/controllers/projects/tree_controller.rb
View file @
d3b24a76
...
@@ -24,6 +24,8 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -24,6 +24,8 @@ class Projects::TreeController < Projects::ApplicationController
end
end
end
end
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@tree
.
path
)
||
@commit
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
# Disable cache so browser history works
# Disable cache so browser history works
...
...
app/views/projects/blob/_blob.html.haml
View file @
d3b24a76
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
.info-well.hidden-xs
.info-well.hidden-xs
.well-segment
.well-segment
%ul
.blob-commit-info
%ul
.blob-commit-info
-
blob_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
blob
.
path
)
=
render
'projects/commits/commit'
,
commit:
@last_commit
,
project:
@project
,
ref:
@ref
=
render
blob_commit
,
project:
@project
,
ref:
@ref
-
auxiliary_viewer
=
blob
.
auxiliary_viewer
-
auxiliary_viewer
=
blob
.
auxiliary_viewer
-
if
auxiliary_viewer
&&
!
auxiliary_viewer
.
render_error
-
if
auxiliary_viewer
&&
!
auxiliary_viewer
.
render_error
...
...
app/views/projects/tree/show.html.haml
View file @
d3b24a76
...
@@ -7,4 +7,4 @@
...
@@ -7,4 +7,4 @@
=
render
'projects/last_push'
=
render
'projects/last_push'
%div
{
class:
container_class
}
%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 @
d3b24a76
---
title
:
Show last commit for current tree on tree page
merge_request
:
author
:
spec/views/projects/tree/show.html.haml_spec.rb
View file @
d3b24a76
...
@@ -21,11 +21,11 @@ describe 'projects/tree/show' do
...
@@ -21,11 +21,11 @@ describe 'projects/tree/show' do
let
(
:tree
)
{
repository
.
tree
(
commit
.
id
,
path
)
}
let
(
:tree
)
{
repository
.
tree
(
commit
.
id
,
path
)
}
before
do
before
do
assign
(
:id
,
File
.
join
(
ref
,
path
))
assign
(
:ref
,
ref
)
assign
(
:ref
,
ref
)
assign
(
:commit
,
commit
)
assign
(
:id
,
commit
.
id
)
assign
(
:tree
,
tree
)
assign
(
:path
,
path
)
assign
(
:path
,
path
)
assign
(
:last_commit
,
commit
)
assign
(
:tree
,
tree
)
end
end
it
'displays correctly'
do
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