diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java index 5bf26202fa98605aba2f44175afddccd8886843f..798ecda86a6f3987543144855bd1c6b83f47c2aa 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java @@ -66,12 +66,6 @@ public class Repository { * @see <a href=https://git-scm.com/docs/git-checkout>git checkout</a> */ public boolean checkout(Commit c) { - - if (!commits.containsValue(c)) { - LOG.warning(() -> String.format("Checkout failed. %s is not part of %s.", c, this)); - return false; - } - Optional<ExecRes> checkout = git.exec(dir, "checkout", c.getId()); Function<ExecRes, Boolean> toBoolean = res -> { boolean failed = git.failed(res); @@ -240,7 +234,13 @@ public class Repository { return Optional.empty(); } - return Optional.of(new Repository(git, url, destination)); + Repository repo = new Repository(git, url, destination); + + for (Map.Entry<String, Commit> entry : commits.entrySet()) { + repo.getCommitUnchecked(entry.getValue().getId()); + } + + return Optional.of(repo); } /**