diff --git a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java b/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java index 72833e44f7..c49490f51c 100644 --- a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java +++ b/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java @@ -565,30 +565,26 @@ public MergeCommand setCommit(boolean commit) { public void execute() throws GitException, InterruptedException { ArgumentListBuilder args = new ArgumentListBuilder(); args.add("merge"); - try { - if(squash) { - args.add("--squash"); - } + if(squash) { + args.add("--squash"); + } - if(!commit){ - args.add("--no-commit"); - } + if(!commit){ + args.add("--no-commit"); + } - if (comment != null && !comment.isEmpty()) { - args.add("-m"); - args.add(comment); - } + if (comment != null && !comment.isEmpty()) { + args.add("-m"); + args.add(comment); + } - if (strategy != null && !strategy.isEmpty() && !strategy.equals(MergeCommand.Strategy.DEFAULT.toString())) { - args.add("-s"); - args.add(strategy); - } - args.add(fastForwardMode); - args.add(rev.name()); - launchCommand(args); - } catch (GitException e) { - throw new GitException("Could not merge " + rev, e); + if (strategy != null && !strategy.isEmpty() && !strategy.equals(MergeCommand.Strategy.DEFAULT.toString())) { + args.add("-s"); + args.add(strategy); } + args.add(fastForwardMode); + args.add(rev.name()); + launchCommand(args); } }; }