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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
eaeb4a90
Commit
eaeb4a90
authored
Sep 25, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix branch API
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
66ef5c1a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
lib/api/branches.rb
lib/api/branches.rb
+2
-2
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+1
-1
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+1
-1
No files found.
lib/api/branches.rb
View file @
eaeb4a90
...
@@ -14,7 +14,7 @@ module API
...
@@ -14,7 +14,7 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/repository/branches
# GET /projects/:id/repository/branches
get
":id/repository/branches"
do
get
":id/repository/branches"
do
present
user_project
.
repo
.
head
s
.
sort_by
(
&
:name
),
with:
Entities
::
RepoObject
,
project:
user_project
present
user_project
.
repo
sitory
.
branche
s
.
sort_by
(
&
:name
),
with:
Entities
::
RepoObject
,
project:
user_project
end
end
# Get a single branch
# Get a single branch
...
@@ -25,7 +25,7 @@ module API
...
@@ -25,7 +25,7 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/repository/branches/:branch
# GET /projects/:id/repository/branches/:branch
get
':id/repository/branches/:branch'
,
requirements:
{
branch:
/.*/
}
do
get
':id/repository/branches/:branch'
,
requirements:
{
branch:
/.*/
}
do
@branch
=
user_project
.
repo
.
head
s
.
find
{
|
item
|
item
.
name
==
params
[
:branch
]
}
@branch
=
user_project
.
repo
sitory
.
branche
s
.
find
{
|
item
|
item
.
name
==
params
[
:branch
]
}
not_found!
(
"Branch does not exist"
)
if
@branch
.
nil?
not_found!
(
"Branch does not exist"
)
if
@branch
.
nil?
present
@branch
,
with:
Entities
::
RepoObject
,
project:
user_project
present
@branch
,
with:
Entities
::
RepoObject
,
project:
user_project
end
end
...
...
spec/models/wiki_page_spec.rb
View file @
eaeb4a90
...
@@ -36,7 +36,7 @@ describe WikiPage do
...
@@ -36,7 +36,7 @@ describe WikiPage do
end
end
it
"sets the version attribute"
do
it
"sets the version attribute"
do
@wiki_page
.
version
.
should
be_a
Commit
@wiki_page
.
version
.
should
be_a
Grit
::
Commit
end
end
end
end
end
end
...
...
spec/requests/api/branches_spec.rb
View file @
eaeb4a90
...
@@ -17,7 +17,7 @@ describe API::API, api: true do
...
@@ -17,7 +17,7 @@ describe API::API, api: true do
get
api
(
"/projects/
#{
project
.
id
}
/repository/branches"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/branches"
,
user
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
should
be_an
Array
json_response
.
first
[
'name'
].
should
==
project
.
repo
.
heads
.
sort_by
(
&
:name
).
first
.
name
json_response
.
first
[
'name'
].
should
==
project
.
repo
sitory
.
branch_names
.
first
end
end
end
end
...
...
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