summaryrefslogtreecommitdiff
path: root/lib/api/repositories.rb
diff options
context:
space:
mode:
authorTimm Drevensek <abubadabu@gmail.com>2014-04-01 22:30:16 +0200
committerTimm Drevensek <abubadabu@gmail.com>2014-04-01 22:30:16 +0200
commitcb659e4c5a1c32bd2aa5c9994cd9d7b4a9841c9b (patch)
tree4b28ca521d9d7420feb2ec705669b90e57a37d58 /lib/api/repositories.rb
parentea82bcd396c9e6ab8542474ee70365297a4ff2dc (diff)
parent3b0510a7c124a8511966ad4785757bd4d78998ac (diff)
downloadgitlab-ce-cb659e4c5a1c32bd2aa5c9994cd9d7b4a9841c9b.tar.gz
Merge branch 'master' into request/relative_submodules
Conflicts: CHANGELOG
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r--lib/api/repositories.rb62
1 files changed, 1 insertions, 61 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index ba53bf9baa4..076a9ceeb74 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -15,66 +15,6 @@ module API
not_found!
end
end
-
- # Get a project repository branches
- #
- # Parameters:
- # id (required) - The ID of a project
- # Example Request:
- # GET /projects/:id/repository/branches
- get ":id/repository/branches" do
- present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject, project: user_project
- end
-
- # Get a single branch
- #
- # Parameters:
- # id (required) - The ID of a project
- # branch (required) - The name of the branch
- # Example Request:
- # GET /projects/:id/repository/branches/:branch
- get ":id/repository/branches/:branch" do
- @branch = user_project.repo.heads.find { |item| item.name == params[:branch] }
- not_found!("Branch does not exist") if @branch.nil?
- present @branch, with: Entities::RepoObject, project: user_project
- end
-
- # Protect a single branch
- #
- # Parameters:
- # id (required) - The ID of a project
- # branch (required) - The name of the branch
- # Example Request:
- # PUT /projects/:id/repository/branches/:branch/protect
- put ":id/repository/branches/:branch/protect" do
- authorize_admin_project
-
- @branch = user_project.repository.find_branch(params[:branch])
- not_found! unless @branch
- protected_branch = user_project.protected_branches.find_by(name: @branch.name)
- user_project.protected_branches.create(name: @branch.name) unless protected_branch
-
- present @branch, with: Entities::RepoObject, project: user_project
- end
-
- # Unprotect a single branch
- #
- # Parameters:
- # id (required) - The ID of a project
- # branch (required) - The name of the branch
- # Example Request:
- # PUT /projects/:id/repository/branches/:branch/unprotect
- put ":id/repository/branches/:branch/unprotect" do
- authorize_admin_project
-
- @branch = user_project.repository.find_branch(params[:branch])
- not_found! unless @branch
- protected_branch = user_project.protected_branches.find_by(name: @branch.name)
- protected_branch.destroy if protected_branch
-
- present @branch, with: Entities::RepoObject, project: user_project
- end
-
# Get a project repository tags
#
# Parameters:
@@ -161,7 +101,7 @@ module API
repo = user_project.repository
ref = params[:sha]
format = params[:format]
- storage_path = Rails.root.join("tmp", "repositories")
+ storage_path = Gitlab.config.gitlab.repository_downloads_path
file_path = repo.archive_repo(ref, storage_path, format)
if file_path && File.exists?(file_path)