Correct Repository.get_git_tree recursive use (#767)

The API docs for Repository.get_git_tree specify that the URL parameter
for fetching a tree recursively should be ?recursive=1, not a truthy
value. To not change the API we present, check if it is True before
setting it to 1. Change another callsite of Repository.get_git_tree to
specify recursive=False to make sure it doesn't appear in the query
string.

Fixes #560
This commit is contained in:
Steve Kowalik
2018-04-25 17:21:17 +08:00
committed by Wan Liuyang
parent d9071a9eda
commit bd0cf30970
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -1727,8 +1727,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
assert isinstance(sha, (str, unicode)), sha
assert recursive is github.GithubObject.NotSet or isinstance(recursive, bool), recursive
url_parameters = dict()
if recursive is not github.GithubObject.NotSet:
url_parameters["recursive"] = recursive
if recursive is not github.GithubObject.NotSet and recursive:
# GitHub API requires the recursive parameter be set to 1.
url_parameters["recursive"] = 1
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.url + "/git/trees/" + sha,