BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
27912f9c
Commit
27912f9c
authored
Dec 23, 2013
by
Thom Gerdes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add api support for raw blob search
See issue
http://feedback.gitlab.com/forums/176466-general/suggestions/4566001-expose-raw-object-search-via-the-gitlab-api
parent
b27bd2b1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
repositories.md
doc/api/repositories.md
+16
-2
repositories.rb
lib/api/repositories.rb
+22
-0
repositories_spec.rb
spec/requests/api/repositories_spec.rb
+7
-0
No files found.
doc/api/repositories.md
View file @
27912f9c
...
@@ -343,9 +343,9 @@ Parameters:
...
@@ -343,9 +343,9 @@ Parameters:
```
```
## Raw
blob
content
## Raw
file
content
Get the raw file contents for a file.
Get the raw file contents for a file
by commit sha and path
.
```
```
GET /projects/:id/repository/blobs/:sha
GET /projects/:id/repository/blobs/:sha
...
@@ -358,6 +358,20 @@ Parameters:
...
@@ -358,6 +358,20 @@ Parameters:
+
`filepath`
(required) - The path the file
+
`filepath`
(required) - The path the file
## Raw blob content
Get the raw file contents for a blob by blob sha.
```
GET /projects/:id/repository/raw_blobs/:sha
```
Parameters:
+
`id`
(required) - The ID of a project
+
`sha`
(required) - The blob sha
## Get file archive
## Get file archive
Get a an archive of the repository
Get a an archive of the repository
...
...
lib/api/repositories.rb
View file @
27912f9c
...
@@ -177,6 +177,28 @@ module API
...
@@ -177,6 +177,28 @@ module API
present
blob
.
data
present
blob
.
data
end
end
# Get a raw blob contents by blob sha
#
# Parameters:
# id (required) - The ID of a project
# sha (required) - The blob's sha
# Example Request:
# GET /projects/:id/repository/raw_blobs/:sha
get
":id/repository/raw_blobs/:sha"
do
ref
=
params
[
:sha
]
repo
=
user_project
.
repository
blob
=
Gitlab
::
Git
::
Blob
.
raw
(
repo
,
ref
)
not_found!
"Blob"
unless
blob
env
[
'api.format'
]
=
:txt
content_type
blob
.
mime_type
present
blob
.
data
end
# Get a an archive of the repository
# Get a an archive of the repository
#
#
# Parameters:
# Parameters:
...
...
spec/requests/api/repositories_spec.rb
View file @
27912f9c
...
@@ -225,6 +225,13 @@ describe API::API do
...
@@ -225,6 +225,13 @@ describe API::API do
end
end
end
end
describe
"GET /projects/:id/repository/raw_blobs/:sha"
do
it
"should get the raw file contents"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/raw_blobs/d1aff2896d99d7acc4d9780fbb716b113c45ecf7"
,
user
)
response
.
status
.
should
==
200
end
end
describe
"GET /projects/:id/repository/archive/:sha"
do
describe
"GET /projects/:id/repository/archive/:sha"
do
it
"should get the archive"
do
it
"should get the archive"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/archive"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/archive"
,
user
)
...
...
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