Skip to content

Commit 1bb58ae

Browse files
committed
fix ups and tags
1 parent 57e371f commit 1bb58ae

6 files changed

Lines changed: 136 additions & 7 deletions

File tree

content/v3/git/blobs.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,31 @@ title: Git DB Blobs API v3 | developer.github.com
44

55
# Blobs API
66

7+
Since blobs can be any arbitrary binary data, the input and responses
8+
for the blob api takes an encoding parameter that can be either `utf-8`
9+
or `base64`. If your data cannot be losslessly sent as a UTF-8 string,
10+
you can base64 encode it.
11+
712
## Get a Blob
813

914
GET /git/:user/:repo/blob/:sha
1015

1116
### Response
1217

1318
<%= headers 200 %>
14-
<%= json :content => "Content of the blob" %>
19+
<%= json :content => "Content of the blob", :encoding => "utf-8" %>
1520

1621
## Create a Blob
1722

1823
POST /git/:user/:repo/blob
1924

2025
### Input
2126

22-
<%= json :content => "Content of the blob" %>
27+
<%= json :content => "Content of the blob", :encoding => "utf-8" %>
2328

2429
### Response
2530

2631
<%= headers 201,
2732
:Location => "https://api.github.com/git/:user/:repo/blob/:sha" %>
28-
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" %>
33+
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", :size => 10 %>
34+

content/v3/git/commits.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,61 @@ title: Git DB Commits API v3 | developer.github.com
1313
<%= headers 200 %>
1414
<%= json :commit %>
1515

16+
## Create a Commit
17+
18+
POST /git/:user/:repo/commit
19+
20+
### Parameters
21+
22+
message
23+
: _String_ of the commit message
24+
25+
tree
26+
: _String_ of the SHA of the tree object this commit points to
27+
28+
parents
29+
: _Array_ of the SHAs of the commits that were the parents of this
30+
commit. If omitted or empty, the commit will be written as a root
31+
commit. For a single parent, an array of one SHA should be provided,
32+
for a merge commit, an array of more than one should be provided.
33+
34+
### Optional Parameters
35+
36+
The `committer` section is optional and will be filled with the `author`
37+
data if omitted. If the `author` section is omitted, it will be filled
38+
in with the authenticated users information and the current date.
39+
40+
41+
author.name
42+
: _String_ of the name of the author of the commit
43+
44+
author.email
45+
: _String_ of the email of the author of the commit
46+
47+
author.date
48+
: _Timestamp_ of when this commit was authored
49+
50+
committer.name
51+
: _String_ of the name of the committer of the commit
52+
53+
committer.email
54+
: _String_ of the email of the committer of the commit
55+
56+
committer.date
57+
: _Timestamp_ of when this commit was committed
58+
59+
### Example Input
60+
61+
<%= json "message"=> "my commit message", \
62+
"author"=> \
63+
{"name" => "file.rb", "email" => "scott@github.com", \
64+
"date" => "2008-07-09T16:13:30+12:00"}, \
65+
"parents"=>["7d1b31e74ee336d15cbd21741bc88a537ed063a0"], \
66+
"tree"=>"827efc6d56897b048c772eb4087f854f46256132" %>
67+
68+
### Response
69+
70+
<%= headers 201,
71+
:Location => "https://api.github.com/git/:user/:repo/commit/:sha" %>
72+
<%= json :sha => "771696840881ef6119cd74e9eb06305dddca8632", :size => 40 %>
73+

content/v3/git/tags.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Git DB Tags API v3 | developer.github.com
3+
---
4+
5+
# Tags API
6+
7+
This tags api only deals with tag objects - so only annotated tags, not
8+
lightweight tags.
9+
10+
## Get a Tag
11+
12+
GET /git/:user/:repo/tag/:sha
13+
14+
### Response
15+
16+
<%= headers 200 %>
17+
<%= json :tag %>
18+
19+
## Create a Tag Object
20+
21+
POST /git/:user/:repo/tag
22+
23+
### Parameters
24+
25+
tag
26+
: _String_ of the tag
27+
28+
message
29+
: _String_ of the tag message
30+
31+
object
32+
: _String_ of the SHA of the git object this is tagging
33+
34+
type
35+
: _String_ of the type of the object we're tagging. Normally this is a
36+
`commit` but it can also be a `tree` or a `blob`.
37+
38+
tagger.name
39+
: _String_ of the name of the author of the tag
40+
41+
tagger.email
42+
: _String_ of the email of the author of the tag
43+
44+
tagger.date
45+
: _Timestamp_ of when this object was tagged
46+
47+
### Response
48+
49+
<%= headers 201,
50+
:Location => "https://api.github.com/git/:user/:repo/tag/:sha" %>
51+
<%= json :sha => "3241bfae562975622c208335e306efd9aa706687", :size => 30 %>
52+

content/v3/git/trees.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@ tree.sha
6060

6161
<%= headers 201,
6262
:Location => "https://api.github.com/git/:user/:repo/tree/:sha" %>
63-
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" %>
63+
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", :size =>
64+
30 %>
6465

layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ <h3><a href="/v3/users/">Users</a></h3>
6464
</ul>
6565
</li>
6666
<li>
67-
<a href="/v3/git/">Git DB</a>
67+
<h3><a href="/v3/git/">Git DB</a></h3>
6868
<ul>
6969
<li><a href="/v3/git/blobs/">Blobs</a></li>
7070
<li><a href="/v3/git/trees/">Trees</a></li>

lib/resources.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,20 @@ def json(key)
333333
},
334334
"message" => "my commit message",
335335
"tree" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
336-
"parents" => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"],
337-
"encoding" => "utf-8"
336+
"parents" => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"]
337+
}
338+
339+
TAG = {
340+
"sha" => "b8d04eddde9f53f3bc76dd048f3477062a27c91a",
341+
"tag" => "v1.0",
342+
"tagger" => {
343+
"name" => "Scott Chacon",
344+
"email" => "scott@github.com",
345+
"date" => "2008-07-09T16:13:30+12:00"
346+
},
347+
"message" => "my tag message",
348+
"object" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
349+
"type" => "commit"
338350
}
339351

340352
end

0 commit comments

Comments
 (0)