Skip to content

Commit 3c62186

Browse files
committed
update the api docs to the new signatures
1 parent 91df23a commit 3c62186

6 files changed

Lines changed: 139 additions & 134 deletions

File tree

content/v3/git/blobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ you can base64 encode it.
3030

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

content/v3/git/commits.md

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,6 @@ title: Git DB Commits API v3 | developer.github.com
44

55
# Commits API
66

7-
## List commits
8-
9-
GET /repos/:user/:repo/git/commits
10-
11-
### Parameters
12-
13-
start
14-
: _String_ of the reference or SHA to start at, or an _Array_ of them if
15-
you want multiple starting points. Defaults to the default branch on the
16-
server.
17-
18-
not
19-
: _String_ of the reference or SHA to end at, or an _Array_ of them if
20-
you want multiple ending points
21-
22-
after
23-
: _Timestamp_ to return commits only authored after the specified date
24-
25-
before
26-
: _Timestamp_ to return commits only authored before the specified date
27-
28-
grep
29-
: _String_ of regex to match against the commit messages
30-
31-
author
32-
: _String_ of regex to match against the author names and email addresses
33-
34-
committer
35-
: _String_ of regex to match against the committer names and email addresses
36-
37-
max
38-
: _Integer_ of maximum number of results to return
39-
40-
skip
41-
: _Integer_ of number of results to skip (for paging)
42-
43-
path
44-
: _String_ of path limiter - only return commits that modified the given
45-
path
46-
47-
### Response
48-
49-
<%= headers 200 %>
50-
<%= json :commits %>
51-
527
## Get a Commit
538

549
GET /repos/:user/:repo/git/commits/:sha
@@ -105,7 +60,7 @@ committer.date
10560

10661
<%= json "message"=> "my commit message", \
10762
"author"=> \
108-
{"name" => "file.rb", "email" => "scott@github.com", \
63+
{"name" => "Scott Chacon", "email" => "schacon@gmail.com", \
10964
"date" => "2008-07-09T16:13:30+12:00"}, \
11065
"parents"=>["7d1b31e74ee336d15cbd21741bc88a537ed063a0"], \
11166
"tree"=>"827efc6d56897b048c772eb4087f854f46256132" %>
@@ -114,5 +69,5 @@ committer.date
11469

11570
<%= headers 201,
11671
:Location => "https://api.github.com/git/:user/:repo/commit/:sha" %>
117-
<%= json :sha => "771696840881ef6119cd74e9eb06305dddca8632", :size => 40 %>
72+
<%= json :new_commit %>
11873

content/v3/git/refs.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ The `ref` in the URL must be formatted as `heads/branch`, not just `branch`. For
1515
### Response
1616

1717
<%= headers 200 %>
18-
<%= json :ref => "refs/heads/sc/featureA", "type" => "commit", \
19-
:sha => "bca1e965df1235af5190b0e7760a456ef9602e9a" %>
18+
<%= json :ref %>
2019

2120
## Get all References
2221

@@ -72,13 +71,13 @@ out or setting it to `false` will make sure you're not overwriting work.
7271

7372
### Input
7473

75-
<%= json "sha"=>"827efc6d56897b048c772eb4087f854f46256132",\
74+
<%= json "sha"=>"aa218f56b14c9653891f9e74264a383fa43fefbd",\
7675
"force"=>true %>
7776

7877
### Response
7978

80-
<%= headers 200 %>
81-
<%= json :ref => "refs/heads/master", "type" => "commit", \
82-
"sha"=>"827efc6d56897b048c772eb4087f854f46256132" %>
79+
<%= headers 200, \
80+
:Location => "https://api.github.com/git/:user/:repo/commit/:sha" %>
81+
<%= json :ref %>
8382

8483

content/v3/git/tags.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ lightweight tags.
1818

1919
## Create a Tag Object
2020

21+
Note that creating a tag object does not create the reference that
22+
makes a tag in Git. If you want to create an annotated tag in Git,
23+
you have to do this call to create the tag object, and then create
24+
the `refs/tags/[tag]` reference. If you want to create a lightweight
25+
tag, you simply have to create the reference - this call would be
26+
unnecessary.
27+
2128
POST /repos/:user/:repo/git/tags
2229

2330
### Parameters
@@ -48,5 +55,5 @@ tagger.date
4855

4956
<%= headers 201,
5057
:Location => "https://api.github.com/repos/:user/:repo/git/tags/:sha" %>
51-
<%= json :sha => "3241bfae562975622c208335e306efd9aa706687", :size => 30 %>
58+
<%= json :tag %>
5259

content/v3/git/trees.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ title: Git DB Trees API v3 | developer.github.com
2020
### Response
2121

2222
<%= headers 200 %>
23-
<%= json :full_tree %>
23+
<%= json :tree_extra %>
2424

2525
## Create a Tree
2626

@@ -66,6 +66,5 @@ tree.content
6666

6767
<%= headers 201,
6868
:Location => "https://api.github.com/repos/:user/:repo/git/trees/:sha" %>
69-
<%= json :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", :size =>
70-
30 %>
69+
<%= json :tree_new %>
7170

lib/resources.rb

Lines changed: 121 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -283,122 +283,167 @@ def json(key)
283283
}
284284

285285
TREE = {
286-
"count" => 3,
287286
"sha" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
287+
"url" => "https://api.github.com/repo/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
288288
"tree" => [
289289
{ "path" => "file.rb",
290290
"mode" => "100644",
291291
"type" => "blob",
292292
"size" => 30,
293-
"sha" => "44b4fc6d56897b048c772eb4087f854f46256132"
293+
"sha" => "44b4fc6d56897b048c772eb4087f854f46256132",
294+
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132",
294295
},
295296
{ "path" => "subdir",
296297
"mode" => "040000",
297298
"type" => "tree",
298-
"sha" => "f484d249c660418515fb01c2b9662073663c242e"
299+
"sha" => "f484d249c660418515fb01c2b9662073663c242e",
300+
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e"
299301
},
300302
{ "path" => "exec_file",
301303
"mode" => "100755",
302304
"type" => "blob",
303305
"size" => 75,
304-
"sha" => "45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
306+
"sha" => "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
307+
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
305308
}
306309
]
307310
}
308311
TREE_EXTRA = {
309-
"count" => 4,
310-
"tree" => {
312+
"sha" => "fc6274d15fa3ae2ab983129fb037999f264ba9a7",
313+
"url" => "https://api.github.com/repo/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7",
314+
"tree" => [ {
311315
"path" => "subdir/file.txt",
312316
"mode" => "100644",
313317
"type" => "blob",
314318
"size" => 132,
315-
"sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
316-
}
319+
"sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
320+
"url" => "https://api.github.com/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
321+
} ]
322+
}
323+
TREE_NEW = {
324+
"sha" => "cd8274d15fa3ae2ab983129fb037999f264ba9a7",
325+
"url" => "https://api.github.com/repo/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7",
326+
"tree" => [ {
327+
"path" => "file.rb",
328+
"mode" => "100644",
329+
"type" => "blob",
330+
"size" => 132,
331+
"sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
332+
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
333+
} ]
317334
}
318-
FULL_TREE = TREE.merge(TREE_EXTRA) do |k, o, n|
319-
k == 'tree' ? o << n : n
320-
end
321335

322336
COMMIT = {
323-
"sha" => "cd52fced9c728f3a37578620e9d6135a55eb2ef2",
337+
"sha" => "7638417db6d59f3c431d3e1f261cc637155684cd",
338+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
324339
"author" => {
325-
"name" => "Scott Chacon",
326-
"email" => "scott@github.com",
327-
"date" => "2008-07-09T16:13:30+12:00"
340+
"date" => "2010-04-10T14:10:01-07:00",
341+
"name" => "Scott Chacon",
342+
"email" => "schacon@gmail.com"
328343
},
329344
"committer" => {
330-
"name" => "Scott Chacon",
331-
"email" => "scott@github.com",
332-
"date" => "2008-07-09T16:13:30+12:00"
345+
"date" => "2010-04-10T14:10:01-07:00",
346+
"name" => "Scott Chacon",
347+
"email" => "schacon@gmail.com"
348+
},
349+
"message" => "added readme, because im a good github citizen\n",
350+
"tree" => {
351+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
352+
"sha" => "691272480426f78a0138979dd3ce63b77f706feb"
333353
},
334-
"message" => "my commit message",
335-
"tree" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
336-
"parents" => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"]
354+
"parents" => [
355+
{
356+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
357+
"sha" => "1acc419d4d6a9ce985db7be48c6349a0475975b5"
358+
}
359+
]
337360
}
338361

339-
COMMITS_REST = [
340-
{ "sha" => "7d1b31e74ee336d15cbd21741bc88a537ed063a0",
341-
"author" => {
342-
"name" => "Scott Chacon",
343-
"email" => "scott@github.com",
344-
"date" => "2008-07-08T16:13:30+12:00"
345-
},
346-
"committer" => {
347-
"name" => "Scott Chacon",
348-
"email" => "scott@github.com",
349-
"date" => "2008-07-08T16:13:30+12:00"
350-
},
351-
"message" => "my older commit message",
352-
"tree" => "392662aae29f314a428bfc6b619d97bd4ad4a727",
353-
"parents" => ["afc99de753646e2c438203430e97671971740d35"]
362+
NEW_COMMIT = {
363+
"sha" => "7638417db6d59f3c431d3e1f261cc637155684cd",
364+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
365+
"author" => {
366+
"date" => "2008-07-09T16:13:30+12:00",
367+
"name" => "Scott Chacon",
368+
"email" => "schacon@gmail.com"
354369
},
355-
{ "sha" => "afc99de753646e2c438203430e97671971740d35",
356-
"author" => {
357-
"name" => "Scott Chacon",
358-
"email" => "scott@github.com",
359-
"date" => "2008-07-07T16:13:30+12:00"
360-
},
361-
"committer" => {
362-
"name" => "Scott Chacon",
363-
"email" => "scott@github.com",
364-
"date" => "2008-07-07T16:13:30+12:00"
365-
},
366-
"message" => "my first commit message",
367-
"tree" => "8bcac778496eb77c1928aa9778f5112c6a822a19",
368-
"parents" => []
369-
}
370-
]
371-
372-
COMMITS = [COMMIT] + COMMITS_REST
373-
370+
"committer" => {
371+
"date" => "2008-07-09T16:13:30+12:00",
372+
"name" => "Scott Chacon",
373+
"email" => "schacon@gmail.com"
374+
},
375+
"message" => "my commit message",
376+
"tree" => {
377+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132",
378+
"sha" => "827efc6d56897b048c772eb4087f854f46256132"
379+
},
380+
"parents" => [
381+
{
382+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0",
383+
"sha" => "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
384+
}
385+
]
386+
}
387+
374388
TAG = {
375-
"sha" => "b8d04eddde9f53f3bc76dd048f3477062a27c91a",
376-
"tag" => "v1.0",
389+
"tag" => "v0.0.1",
390+
"sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
391+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac",
392+
"message" => "initial version\n",
377393
"tagger" => {
378-
"name" => "Scott Chacon",
379-
"email" => "scott@github.com",
380-
"date" => "2008-07-09T16:13:30+12:00"
394+
"name" => "Scott Chacon",
395+
"email" => "schacon@gmail.com",
396+
"date" => "2011-06-17T14:53:35-07:00"
381397
},
382-
"message" => "my tag message",
383-
"object" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
384-
"type" => "commit"
398+
"object" => {
399+
"type" => "commit",
400+
"sha" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
401+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
402+
}
385403
}
386404

387-
REFS = [
388-
{ "ref" => "refs/heads/master",
389-
"sha" => "75e41c7ddf122d799730c39d2295ee840d9b7b08",
390-
"type" => "commit" },
391-
{ "ref" => "refs/heads/gh-page",
392-
"sha" => "1bb58aecaf6bbcf9f7e39dff2e42e0291f42d235",
393-
"type" => "commit" },
394-
{ "ref" => "refs/tags/v0.1",
395-
"sha" => "be87be3a49e75474e438a9a9f44b3deafb0af01c",
396-
"type" => "tag" },
397-
{ "ref" => "refs/notes/commits",
398-
"sha" => "1bb58aecaf6bbcf9f7e39dff2e42e0291f42d235",
399-
"type" => "commit" },
405+
REF = [
406+
{
407+
"ref" => "refs/heads/sc/featureA",
408+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA",
409+
"object" => {
410+
"type" => "commit",
411+
"sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd",
412+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
413+
}
414+
}
400415
]
401416

417+
REFS = [
418+
{
419+
"ref" => "refs/heads/master",
420+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/master",
421+
"object" => {
422+
"type" => "commit",
423+
"sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd",
424+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
425+
}
426+
},
427+
{
428+
"ref" => "refs/heads/gh-pages",
429+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/gh-pages",
430+
"object" => {
431+
"type" => "commit",
432+
"sha" => "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac",
433+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac"
434+
}
435+
},
436+
{
437+
"ref" => "refs/tags/v0.0.1",
438+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.0.1",
439+
"object" => {
440+
"type" => "tag",
441+
"sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
442+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac"
443+
}
444+
}
445+
]
446+
402447
end
403448
end
404449

0 commit comments

Comments
 (0)