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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
11d56a15
Commit
11d56a15
authored
Jul 20, 2018
by
Kia Mei Somabes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect commits to root_ref if no ref is provided
parent
0ed8f349
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-0
changelogs/unreleased/31576-redirect-commits-to-root-if-no-ref.yml
...s/unreleased/31576-redirect-commits-to-root-if-no-ref.yml
+5
-0
config/routes/repository.rb
config/routes/repository.rb
+1
-0
No files found.
app/controllers/application_controller.rb
View file @
11d56a15
...
...
@@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base
render_503
end
def
redirect_commits_root
redirect_to
:controller
=>
'commits'
,
:action
=>
'show'
,
:id
=>
@repository
.
root_ref
end
def
redirect_back_or_default
(
default:
root_path
,
options:
{})
redirect_to
request
.
referer
.
present?
?
:back
:
default
,
options
end
...
...
changelogs/unreleased/31576-redirect-commits-to-root-if-no-ref.yml
0 → 100644
View file @
11d56a15
---
title
:
Redirect commits to root if no ref is provided (31576)
merge_request
:
author
:
Kia Mei Somabes
type
:
added
config/routes/repository.rb
View file @
11d56a15
...
...
@@ -83,6 +83,7 @@ scope format: false do
get
'/raw/*id'
,
to:
'raw#show'
,
as: :raw
get
'/blame/*id'
,
to:
'blame#show'
,
as: :blame
get
'/commits/'
,
to:
'application#redirect_commits_root'
,
as: :commits_root
get
'/commits/*id/signatures'
,
to:
'commits#signatures'
,
as: :signatures
get
'/commits/*id'
,
to:
'commits#show'
,
as: :commits
...
...
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