mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Allow sha=None for InputGitTreeElement (#1327)
InputGitTreeElement is used to build tree objects for Repository.create_git_tree(). However, the GitHub API allows passing sha=null to delete a file, which we don't allow. Extend the checking in InputGitTreeElement to also allow None, and add a test for good measure. Fixes #1318
This commit is contained in:
@@ -53,7 +53,7 @@ class InputGitTreeElement(object):
|
||||
:param mode: string
|
||||
:param type: string
|
||||
:param content: string
|
||||
:param sha: string
|
||||
:param sha: string or None
|
||||
"""
|
||||
|
||||
assert isinstance(path, (str, six.text_type)), path
|
||||
@@ -62,8 +62,10 @@ class InputGitTreeElement(object):
|
||||
assert content is github.GithubObject.NotSet or isinstance(
|
||||
content, (str, six.text_type)
|
||||
), content
|
||||
assert sha is github.GithubObject.NotSet or isinstance(
|
||||
sha, (str, six.text_type)
|
||||
assert (
|
||||
sha is github.GithubObject.NotSet
|
||||
or sha is None
|
||||
or isinstance(sha, (str, six.text_type))
|
||||
), sha
|
||||
self.__path = path
|
||||
self.__mode = mode
|
||||
|
||||
Reference in New Issue
Block a user