Commit 25efc5f2 authored by Riccardo Padovani's avatar Riccardo Padovani

Add default parameter to branches API

parent 197a305b
---
title: Add default parameter to branches API
merge_request: 21294
author: Riccardo Padovani
type: changed
......@@ -27,6 +27,7 @@ Example response:
"name": "master",
"merged": false,
"protected": true,
"default": true,
"developers_can_push": false,
"developers_can_merge": false,
"can_push": true,
......@@ -75,6 +76,7 @@ Example response:
"name": "master",
"merged": false,
"protected": true,
"default": true,
"developers_can_push": false,
"developers_can_merge": false,
"can_push": true,
......@@ -141,6 +143,7 @@ Example response:
"name": "master",
"merged": false,
"protected": true,
"default": true,
"developers_can_push": true,
"developers_can_merge": true,
"can_push": true
......@@ -190,6 +193,7 @@ Example response:
"name": "master",
"merged": false,
"protected": false,
"default": true,
"developers_can_push": false,
"developers_can_merge": false,
"can_push": true
......@@ -234,6 +238,7 @@ Example response:
"name": "newbranch",
"merged": false,
"protected": false,
"default": false,
"developers_can_push": false,
"developers_can_merge": false,
"can_push": true
......
......@@ -369,6 +369,10 @@ module API
expose :can_push do |repo_branch, options|
Gitlab::UserAccess.new(options[:current_user], project: options[:project]).can_push_to_branch?(repo_branch.name)
end
expose :default do |repo_branch, options|
options[:project].default_branch == repo_branch.name
end
end
class TreeObject < Grape::Entity
......
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