Skip to content
Snippets Groups Projects
Commit b1d70360 authored by Georg Seibt's avatar Georg Seibt :nerd:
Browse files

remove contains check in Repository::checkout (problematic in conjunction with...

remove contains check in Repository::checkout (problematic in conjunction with the copy method and the git call will fail anyway if the commit id is invalid), copy commits in Repository::copy
parent 6e09b797
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment