Repository: sigmavirus24/github3.py

Issue:
Allow `commit_message` default for merging
To do this, `commit_message` must be omitted from the request (not just empty).

https://github.com/sigmavirus24/github3.py/blob/7ebca532da8dcc7f22be9f7f1b13fdea3e4d34c0/github3/pulls.py#L312-L331

https://developer.github.com/v3/repos/merging/


<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39229921-allow-commit_message-default-for-merging?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github).
</bountysource-plugin>

Discussion:
sigmavirus24: You'll need to rebase this on top of develop once #652 merges.
sigmavirus24: Closing & Reopening apparently will trigger a new merged build on Travis.
itsmemattchung: Thanks for submitting the PR.  Instead of modifying the existing test case, test_merge, please add a new test case to cover the new use case (i.e not passing in `commit_message`)
broady: I haven't forgotten about this. I'll finish this up in the next couple days. Thanks for the review.

Patch:
diff --git a/github3/pulls.py b/github3/pulls.py
index e1b843cd..2511c004 100644
--- a/github3/pulls.py
+++ b/github3/pulls.py
@@ -311,7 +311,7 @@ class PullRequest(models.GitHubCore):
         return self._iter(int(number), url, IssueComment, etag=etag)
 
     @requires_auth
-    def merge(self, commit_message='', sha=None, squash=False):
+    def merge(self, commit_message=None, sha=None, squash=False):
         """Merge this pull request.
 
         :param str commit_message: (optional), message to be used for the
@@ -322,9 +322,11 @@ class PullRequest(models.GitHubCore):
             head branch.
         :returns: bool
         """
-        parameters = {'commit_message': commit_message, 'squash': squash}
+        parameters = {'squash': squash}
         if sha:
             parameters['sha'] = sha
+        if commit_message is not None:
+            parameters['commit_message'] = commit_message
         url = self._build_url('merge', base_url=self._api)
         json = self._json(self._put(url, data=dumps(parameters)), 200)
         if not json:


Test patch:
diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py
index a5b7480b..828c1b29 100644
--- a/tests/unit/test_pulls.py
+++ b/tests/unit/test_pulls.py
@@ -95,7 +95,7 @@ class TestPullRequest(helper.UnitHelper):
 
         self.put_called_with(
             url_for('merge'),
-            data={"squash": False, "commit_message": ""}
+            data={"squash": False}
         )
 
     def test_merge_squash_message(self):