Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit d95a6e0

Browse files
Kasi-Rlafriks
authored andcommitted
added recursive support to git trees api (#130)
1 parent 545830e commit d95a6e0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gitea/repo_tree.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ type GitTreeResponse struct {
2828

2929
// GetTrees downloads a file of repository, ref can be branch/tag/commit.
3030
// e.g.: ref -> master, tree -> macaron.go(no leading slash)
31-
func (c *Client) GetTrees(user, repo, ref string) (*GitTreeResponse, error) {
31+
func (c *Client) GetTrees(user, repo, ref string, recursive bool) (*GitTreeResponse, error) {
3232
var trees GitTreeResponse
33-
_, err := c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/git/trees/%s", user, repo, ref), nil, nil)
33+
var path = fmt.Sprintf("/repos/%s/%s/git/trees/%s", user, repo, ref)
34+
if recursive {
35+
path += "?recursive=1"
36+
}
37+
err := c.getParsedResponse("GET", path, nil, nil, &trees)
3438
return &trees, err
3539
}

0 commit comments

Comments
 (0)