Skip to content

Commit 39c06c9

Browse files
committed
Fix exception when merging with empty commit message
Fixes sigmavirus24#370 The GitHub API now requires a param `commit_message` with an empty value '' when merging a pull request. In such case the default value is used as a commit message. Providing an empty data string no longer works.
1 parent 83c4de6 commit 39c06c9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

github3/pulls.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,7 @@ def merge(self, commit_message=''):
313313
merge commit
314314
:returns: bool
315315
"""
316-
data = None
317-
if commit_message:
318-
data = dumps({'commit_message': commit_message})
316+
data = dumps({'commit_message': commit_message})
319317
url = self._build_url('merge', base_url=self._api)
320318
json = self._json(self._put(url, data=data), 200)
321319
if not json:

tests/unit/test_pulls.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def test_merge(self):
6767
"""Show that a user can merge a Pull Request."""
6868
self.instance.merge()
6969

70-
self.session.put.assert_called_once_with(url_for('merge'), data=None)
70+
self.session.put.assert_called_once_with(
71+
url_for('merge'),
72+
data='{"commit_message": ""}')
7173

7274
def test_patch(self):
7375
"""Show that a user can fetch the patch from a Pull Request."""

0 commit comments

Comments
 (0)