Skip to content

Commit e94b955

Browse files
authored
Add SubmoduleGitURL to RepositoryContent (#2880)
Fixes: #2877.
1 parent 0c562f6 commit e94b955

File tree

5 files changed

+69
-45
lines changed

5 files changed

+69
-45
lines changed

github/github-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-stringify_test.go

Lines changed: 14 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/repos_contents.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ type RepositoryContent struct {
3636
// Content contains the actual file content, which may be encoded.
3737
// Callers should call GetContent which will decode the content if
3838
// necessary.
39-
Content *string `json:"content,omitempty"`
40-
SHA *string `json:"sha,omitempty"`
41-
URL *string `json:"url,omitempty"`
42-
GitURL *string `json:"git_url,omitempty"`
43-
HTMLURL *string `json:"html_url,omitempty"`
44-
DownloadURL *string `json:"download_url,omitempty"`
39+
Content *string `json:"content,omitempty"`
40+
SHA *string `json:"sha,omitempty"`
41+
URL *string `json:"url,omitempty"`
42+
GitURL *string `json:"git_url,omitempty"`
43+
HTMLURL *string `json:"html_url,omitempty"`
44+
DownloadURL *string `json:"download_url,omitempty"`
45+
SubmoduleGitURL *string `json:"submodule_git_url,omitempty"`
4546
}
4647

4748
// RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile.

github/repos_contents_test.go

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -782,18 +782,19 @@ func TestRepositoryContent_Marshal(t *testing.T) {
782782
testJSONMarshal(t, &RepositoryContent{}, "{}")
783783

784784
r := &RepositoryContent{
785-
Type: String("type"),
786-
Target: String("target"),
787-
Encoding: String("encoding"),
788-
Size: Int(1),
789-
Name: String("name"),
790-
Path: String("path"),
791-
Content: String("content"),
792-
SHA: String("sha"),
793-
URL: String("url"),
794-
GitURL: String("gurl"),
795-
HTMLURL: String("hurl"),
796-
DownloadURL: String("durl"),
785+
Type: String("type"),
786+
Target: String("target"),
787+
Encoding: String("encoding"),
788+
Size: Int(1),
789+
Name: String("name"),
790+
Path: String("path"),
791+
Content: String("content"),
792+
SHA: String("sha"),
793+
URL: String("url"),
794+
GitURL: String("gurl"),
795+
HTMLURL: String("hurl"),
796+
DownloadURL: String("durl"),
797+
SubmoduleGitURL: String("smgurl"),
797798
}
798799

799800
want := `{
@@ -808,7 +809,8 @@ func TestRepositoryContent_Marshal(t *testing.T) {
808809
"url": "url",
809810
"git_url": "gurl",
810811
"html_url": "hurl",
811-
"download_url": "durl"
812+
"download_url": "durl",
813+
"submodule_git_url": "smgurl"
812814
}`
813815

814816
testJSONMarshal(t, r, want)
@@ -819,18 +821,19 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) {
819821

820822
r := &RepositoryContentResponse{
821823
Content: &RepositoryContent{
822-
Type: String("type"),
823-
Target: String("target"),
824-
Encoding: String("encoding"),
825-
Size: Int(1),
826-
Name: String("name"),
827-
Path: String("path"),
828-
Content: String("content"),
829-
SHA: String("sha"),
830-
URL: String("url"),
831-
GitURL: String("gurl"),
832-
HTMLURL: String("hurl"),
833-
DownloadURL: String("durl"),
824+
Type: String("type"),
825+
Target: String("target"),
826+
Encoding: String("encoding"),
827+
Size: Int(1),
828+
Name: String("name"),
829+
Path: String("path"),
830+
Content: String("content"),
831+
SHA: String("sha"),
832+
URL: String("url"),
833+
GitURL: String("gurl"),
834+
HTMLURL: String("hurl"),
835+
DownloadURL: String("durl"),
836+
SubmoduleGitURL: String("smgurl"),
834837
},
835838
Commit: Commit{
836839
SHA: String("s"),
@@ -893,7 +896,8 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) {
893896
"url": "url",
894897
"git_url": "gurl",
895898
"html_url": "hurl",
896-
"download_url": "durl"
899+
"download_url": "durl",
900+
"submodule_git_url": "smgurl"
897901
},
898902
"commit": {
899903
"sha": "s",

0 commit comments

Comments
 (0)