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
Jérome Perrin
gitlab-ce
Commits
d3ecf95d
Commit
d3ecf95d
authored
Oct 01, 2017
by
Guilherme Vieira
Committed by
Winnie Hellmann
Oct 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renders 404 in commits controller if no commits are found
parent
85fbb47b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
3 deletions
+37
-3
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+2
-0
changelogs/unreleased/not-found-in-commits.yml
changelogs/unreleased/not-found-in-commits.yml
+5
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+1
-1
spec/controllers/projects/commits_controller_spec.rb
spec/controllers/projects/commits_controller_spec.rb
+29
-2
No files found.
app/controllers/projects/commits_controller.rb
View file @
d3ecf95d
...
@@ -48,6 +48,8 @@ class Projects::CommitsController < Projects::ApplicationController
...
@@ -48,6 +48,8 @@ class Projects::CommitsController < Projects::ApplicationController
private
private
def
set_commits
def
set_commits
render_404
unless
request
.
format
==
:atom
||
@repository
.
blob_at
(
@commit
.
id
,
@path
)
||
@repository
.
tree
(
@commit
.
id
,
@path
).
entries
.
present?
@limit
,
@offset
=
(
params
[
:limit
]
||
40
).
to_i
,
(
params
[
:offset
]
||
0
).
to_i
@limit
,
@offset
=
(
params
[
:limit
]
||
40
).
to_i
,
(
params
[
:offset
]
||
0
).
to_i
search
=
params
[
:search
]
search
=
params
[
:search
]
...
...
changelogs/unreleased/not-found-in-commits.yml
0 → 100644
View file @
d3ecf95d
---
title
:
Renders 404 in commits controller if no commits are found for a given path
merge_request
:
14610
author
:
Guilherme Vieira
type
:
fixed
features/steps/shared/paths.rb
View file @
d3ecf95d
...
@@ -222,7 +222,7 @@ module SharedPaths
...
@@ -222,7 +222,7 @@ module SharedPaths
end
end
step
"I visit my project's commits page for a specific path"
do
step
"I visit my project's commits page for a specific path"
do
visit
project_commits_path
(
@project
,
root_ref
+
"/
app/models/project
.rb"
,
{
limit:
5
})
visit
project_commits_path
(
@project
,
root_ref
+
"/
files/ruby/regex
.rb"
,
{
limit:
5
})
end
end
step
'I visit my project\'s commits stats page'
do
step
'I visit my project\'s commits stats page'
do
...
...
spec/controllers/projects/commits_controller_spec.rb
View file @
d3ecf95d
...
@@ -10,9 +10,36 @@ describe Projects::CommitsController do
...
@@ -10,9 +10,36 @@ describe Projects::CommitsController do
end
end
describe
"GET show"
do
describe
"GET show"
do
context
"when the ref name ends in .atom"
do
render_views
render_views
context
'with file path'
do
before
do
get
(
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
id
)
end
context
"valid branch, valid file"
do
let
(
:id
)
{
'master/README.md'
}
it
{
is_expected
.
to
respond_with
(
:success
)
}
end
context
"valid branch, invalid file"
do
let
(
:id
)
{
'master/invalid-path.rb'
}
it
{
is_expected
.
to
respond_with
(
:not_found
)
}
end
context
"invalid branch, valid file"
do
let
(
:id
)
{
'invalid-branch/README.md'
}
it
{
is_expected
.
to
respond_with
(
:not_found
)
}
end
end
context
"when the ref name ends in .atom"
do
context
"when the ref does not exist with the suffix"
do
context
"when the ref does not exist with the suffix"
do
it
"renders as atom"
do
it
"renders as atom"
do
get
(
:show
,
get
(
:show
,
...
...
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