Skip to content

Commit 9012820

Browse files
committed
Massage the signature a bit.
AFAICT sha and merge_method are not mutually exclusive.
1 parent fe2af19 commit 9012820

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/main/java/org/kohsuke/github/GHPullRequest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public GHPullRequestReviewComment createReviewComment(String body, String sha, S
277277
* Commit message. If null, the default one will be used.
278278
*/
279279
public void merge(String msg) throws IOException {
280-
merge(msg,(String)null);
280+
merge(msg,null);
281281
}
282282

283283
/**
@@ -291,7 +291,7 @@ public void merge(String msg) throws IOException {
291291
* SHA that pull request head must match to allow merge.
292292
*/
293293
public void merge(String msg, String sha) throws IOException {
294-
new Requester(root).method("PUT").with("commit_message",msg).with("sha",sha).to(getApiRoute()+"/merge");
294+
merge(msg, sha, null);
295295
}
296296

297297
/**
@@ -304,11 +304,12 @@ public void merge(String msg, String sha) throws IOException {
304304
* @param method
305305
* SHA that pull request head must match to allow merge.
306306
*/
307-
public void merge(String msg, MergeMethod method) throws IOException {
307+
public void merge(String msg, String sha, MergeMethod method) throws IOException {
308308
new Requester(root).method("PUT")
309-
.with("commit_message",msg)
310-
.with("merge_method",method)
311-
.to(getApiRoute()+"/merge");
309+
.with("commit_message",msg)
310+
.with("sha",sha)
311+
.with("merge_method",method)
312+
.to(getApiRoute()+"/merge");
312313
}
313314

314315
public enum MergeMethod{ MERGE, SQUASH, REBASE }

src/main/java/org/kohsuke/github/extras/OkHttpConnector.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ public HttpURLConnection connect(URL url) throws IOException {
3030
return urlFactory.open(url);
3131
}
3232
}
33+
GHPul

src/test/java/org/kohsuke/github/PullRequestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testSquashMerge() throws Exception {
7878
Thread.sleep(1000);
7979
GHPullRequest p = getRepository().createPullRequest(name, name, "master", "## test squash");
8080
Thread.sleep(1000);
81-
p.merge("squash merge", GHPullRequest.MergeMethod.SQUASH);
81+
p.merge("squash merge", null, GHPullRequest.MergeMethod.SQUASH);
8282
branchRef.delete();
8383
}
8484

0 commit comments

Comments
 (0)