Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commitfbc2eed

Browse files
committed
Merge github/master from upstream
1 parentca3a146 commitfbc2eed

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
kind:change
3+
title:Improved Support for Submodules in the Repository Contents API
4+
created_at:2013-04-30
5+
author_name:jasonrudolph
6+
---
7+
8+
When you view a repository with a submodule on github.com, you get useful links and information for the submodule.
9+
10+
[![Repository Contents with Submodule](/images/posts/submodule-links.png)][screenshot]
11+
12+
Today we're making that data available in the[Repository Contents API][docs].
13+
14+
<preclass="terminal">
15+
curl https://api.github.com/repos/jquery/jquery/contents/test/qunit
16+
17+
{
18+
"name": "qunit",
19+
"path": "test/qunit",
20+
"type": "submodule",
21+
"submodule_git_url": "git://github.com/jquery/qunit.git",
22+
"sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
23+
"size": 0,
24+
"url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
25+
"git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
26+
"html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
27+
"_links": {
28+
"self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
29+
"git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
30+
"html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
31+
}
32+
}
33+
</pre>
34+
35+
If you have any questions or feedback, please drop us a line at
36+
[support@github.com](mailto:support@github.com?subject=Submodules in Repository Contents API).
37+
38+
[docs]:/v3/repos/contents/#get-contents
39+
[screenshot]:/images/posts/submodule-links.png

‎content/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ objects.
4646
*`[ ]` Use JSON to POST to the "repos/:owner/:repo/forks" endpoint, instead of a query string.
4747
*`[✓]` <del>User Emails come back[as a hash][v3-email] instead of a string.</del>
4848
*`[ ]` Remove the unused "bio" field for Users.
49+
*`[ ]` When listing the contents of a directory in the[Repository Contents API](/v3/repos/contents/#get-contents), fix the`type` value returned for submodules: change the value to`"submodule"` (instead of`"file"`).
4950

5051
###Breaking Beta Changes
5152

‎content/v3/repos/contents.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This method returns the contents of a file or directory in a repository.
3535
GET /repos/:owner/:repo/contents/:path
3636

3737
Files and symlinks support[a custom media type](#custom-media-types) for getting the raw content.
38-
Directories do_not_ support custom media types.
38+
Directoriesand submodulesdo_not_ support custom media types.
3939

4040
*Notes*:
4141

@@ -69,6 +69,16 @@ Otherwise, the API responds with a hash describing the symlink itself:
6969
<%= headers 200 %>
7070
<%= json:symlink_content %>
7171

72+
###Response if content is a submodule
73+
74+
<%= headers 200 %>
75+
<%= json:submodule_content %>
76+
77+
The`submodule_git_url` identifies the location of the submodule repository, and the`sha` identifies a specific commit within the submodule repository.
78+
Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit.
79+
80+
If the submodule repository is not hosted on github.com, the Git URLs (`git_url` and`_links["git"]`) and the github.com URLs (`html_url` and`_links["html"]`) will have null values.
81+
7282
##Get archive link
7383

7484
This method will return a`302` to a URL to download a tarball

‎lib/resources.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,23 @@ def text_html(response, status, head = {})
10211021
},
10221022
}
10231023

1024+
SUBMODULE_CONTENT={
1025+
"type"=>"submodule",
1026+
"submodule_git_url"=>"git://github.com/jquery/qunit.git",
1027+
"size"=>0,
1028+
"name"=>"qunit",
1029+
"path"=>"test/qunit",
1030+
"sha"=>"6ca3721222109997540bd6d9ccd396902e0ad2f9",
1031+
"url"=>"https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
1032+
"git_url"=>"https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1033+
"html_url"=>"https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1034+
"_links"=>{
1035+
"git"=>"https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1036+
"self"=>"https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
1037+
"html"=>"https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
1038+
}
1039+
}
1040+
10241041
DIRECTORY_CONTENT=[
10251042
{
10261043
"type"=>"file",
87.1 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp