2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
# All routing related to repository browsing
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2021-03-30 14:10:47 -04:00
|
|
|
resource :repository, only: [:create]
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2020-02-05 16:09:02 -05:00
|
|
|
resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do
|
|
|
|
member do
|
|
|
|
get :branches
|
|
|
|
get :pipelines
|
|
|
|
post :revert
|
|
|
|
post :cherry_pick
|
|
|
|
get :diff_for_path
|
2020-08-12 08:10:25 -04:00
|
|
|
get :diff_files
|
2020-02-05 16:09:02 -05:00
|
|
|
get :merge_requests
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-16 05:09:37 -04:00
|
|
|
# NOTE: Add new routes to repository_scoped.rb instead (see
|
|
|
|
# https://docs.gitlab.com/ee/development/routing.html#project-routes).
|
|
|
|
#
|
2017-04-13 12:44:52 -04:00
|
|
|
# Don't use format parameter as file extension (old 3.0.x behavior)
|
|
|
|
# See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
|
|
|
|
scope format: false do
|
|
|
|
get '/compare/:from...:to', to: 'compare#show', as: 'compare', constraints: { from: /.+/, to: /.+/ }
|
|
|
|
|
|
|
|
resources :compare, only: [:index, :create] do
|
|
|
|
collection do
|
|
|
|
get :diff_for_path
|
2018-05-07 04:41:36 -04:00
|
|
|
get :signatures
|
2017-04-13 12:44:52 -04:00
|
|
|
end
|
2016-11-07 10:14:34 -05:00
|
|
|
end
|
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
resources :refs, only: [] do
|
|
|
|
collection do
|
|
|
|
get 'switch'
|
|
|
|
end
|
|
|
|
|
|
|
|
member do
|
|
|
|
# tree viewer logs
|
2017-05-24 16:59:26 -04:00
|
|
|
get 'logs_tree', constraints: { id: Gitlab::PathRegex.git_reference_regex }
|
2017-04-13 12:44:52 -04:00
|
|
|
# Directories with leading dots erroneously get rejected if git
|
|
|
|
# ref regex used in constraints. Regex verification now done in controller.
|
|
|
|
get 'logs_tree/*path', action: :logs_tree, as: :logs_file, format: false, constraints: {
|
|
|
|
id: /.*/,
|
2019-09-23 17:06:29 -04:00
|
|
|
path: /[^\0]*/
|
2017-04-13 12:44:52 -04:00
|
|
|
}
|
|
|
|
end
|
2016-11-07 10:14:34 -05:00
|
|
|
end
|
|
|
|
|
2019-12-18 16:07:37 -05:00
|
|
|
scope constraints: { id: /[^\0]+/ } do
|
2017-04-13 12:44:52 -04:00
|
|
|
scope controller: :blob do
|
|
|
|
get '/new/*id', action: :new, as: :new_blob
|
|
|
|
post '/create/*id', action: :create, as: :create_blob
|
|
|
|
get '/edit/*id', action: :edit, as: :edit_blob
|
|
|
|
put '/update/*id', action: :update, as: :update_blob
|
|
|
|
post '/preview/*id', action: :preview, as: :preview_blob
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
scope path: '/blob/*id', as: :blob do
|
|
|
|
get :diff
|
|
|
|
get '/', action: :show
|
|
|
|
delete '/', action: :destroy
|
|
|
|
post '/', action: :create
|
|
|
|
put '/', action: :update
|
|
|
|
end
|
|
|
|
end
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
get '/tree/*id', to: 'tree#show', as: :tree
|
|
|
|
get '/raw/*id', to: 'raw#show', as: :raw
|
|
|
|
get '/blame/*id', to: 'blame#show', as: :blame
|
2017-07-25 03:40:23 -04:00
|
|
|
|
2018-07-23 20:04:16 -04:00
|
|
|
get '/commits', to: 'commits#commits_root', as: :commits_root
|
2017-07-25 03:40:23 -04:00
|
|
|
get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures
|
2017-04-13 12:44:52 -04:00
|
|
|
get '/commits/*id', to: 'commits#show', as: :commits
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
post '/create_dir/*id', to: 'tree#create_dir', as: :create_dir
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
scope controller: :find_file do
|
|
|
|
get '/find_file/*id', action: :show, as: :find_file
|
2016-11-07 10:14:34 -05:00
|
|
|
|
2017-04-13 12:44:52 -04:00
|
|
|
get '/files/*id', action: :list, as: :files
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|