diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java index 7f5932a589edec759cd627eb367c21707fe75063..96d46cc10a0c3e4eb4018edc76d9d6dbc4f704b7 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java @@ -61,13 +61,16 @@ public abstract class Reference { } /** - * Performs a merge of <code>this</code> and <code>other</code>. <code>Other</code> must be part of the same - * {@link Repository} this {@link Reference} is. + * Performs a checkout followed by a merge of <code>this</code> and <code>other</code>. <code>Other</code> must be + * part of the same {@link Repository} this {@link Reference} is. * * @param other the {@link Reference} to merge * @return <code>false</code>, if the merge failed, or contains conflicts. */ public Boolean merge(Reference other) { + if (!repo.checkout(this)) { + return false; + } Optional<ProcessExecutor.ExecRes> mergeBase = git.exec(repo.getDir(), "merge", "-n", "-q", other.getId()); Function<ProcessExecutor.ExecRes, Boolean> toBoolean = res -> { if (git.failed(res)) {