Commit 21b7e203 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'feature/#32877-add-default-field-branch-api' into 'master'

Add default parameter to branches API

Closes #32877

See merge request gitlab-org/gitlab-ce!21294
parents f9b96bd2 5e5a16a5
---
title: Add default parameter to branches API
merge_request: 21294
author: Riccardo Padovani
type: changed
...@@ -27,6 +27,7 @@ Example response: ...@@ -27,6 +27,7 @@ Example response:
"name": "master", "name": "master",
"merged": false, "merged": false,
"protected": true, "protected": true,
"default": true,
"developers_can_push": false, "developers_can_push": false,
"developers_can_merge": false, "developers_can_merge": false,
"can_push": true, "can_push": true,
...@@ -75,6 +76,7 @@ Example response: ...@@ -75,6 +76,7 @@ Example response:
"name": "master", "name": "master",
"merged": false, "merged": false,
"protected": true, "protected": true,
"default": true,
"developers_can_push": false, "developers_can_push": false,
"developers_can_merge": false, "developers_can_merge": false,
"can_push": true, "can_push": true,
...@@ -141,6 +143,7 @@ Example response: ...@@ -141,6 +143,7 @@ Example response:
"name": "master", "name": "master",
"merged": false, "merged": false,
"protected": true, "protected": true,
"default": true,
"developers_can_push": true, "developers_can_push": true,
"developers_can_merge": true, "developers_can_merge": true,
"can_push": true "can_push": true
...@@ -190,6 +193,7 @@ Example response: ...@@ -190,6 +193,7 @@ Example response:
"name": "master", "name": "master",
"merged": false, "merged": false,
"protected": false, "protected": false,
"default": true,
"developers_can_push": false, "developers_can_push": false,
"developers_can_merge": false, "developers_can_merge": false,
"can_push": true "can_push": true
...@@ -234,6 +238,7 @@ Example response: ...@@ -234,6 +238,7 @@ Example response:
"name": "newbranch", "name": "newbranch",
"merged": false, "merged": false,
"protected": false, "protected": false,
"default": false,
"developers_can_push": false, "developers_can_push": false,
"developers_can_merge": false, "developers_can_merge": false,
"can_push": true "can_push": true
......
...@@ -370,6 +370,10 @@ module API ...@@ -370,6 +370,10 @@ module API
expose :can_push do |repo_branch, options| expose :can_push do |repo_branch, options|
Gitlab::UserAccess.new(options[:current_user], project: options[:project]).can_push_to_branch?(repo_branch.name) Gitlab::UserAccess.new(options[:current_user], project: options[:project]).can_push_to_branch?(repo_branch.name)
end end
expose :default do |repo_branch, options|
options[:project].default_branch == repo_branch.name
end
end end
class TreeObject < Grape::Entity class TreeObject < Grape::Entity
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"commit", "commit",
"merged", "merged",
"protected", "protected",
"default",
"developers_can_push", "developers_can_push",
"developers_can_merge" "developers_can_merge"
], ],
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
"commit": { "$ref": "commit/basic.json" }, "commit": { "$ref": "commit/basic.json" },
"merged": { "type": "boolean" }, "merged": { "type": "boolean" },
"protected": { "type": "boolean" }, "protected": { "type": "boolean" },
"default": { "type": "boolean" },
"developers_can_push": { "type": "boolean" }, "developers_can_push": { "type": "boolean" },
"developers_can_merge": { "type": "boolean" }, "developers_can_merge": { "type": "boolean" },
"can_push": { "type": "boolean" } "can_push": { "type": "boolean" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment