From d387515aabd2bc92e4f536fd8a104e1ef0287f2c Mon Sep 17 00:00:00 2001 From: Georg Seibt <seibt@fim.uni-passau.de> Date: Mon, 31 Oct 2016 13:05:46 +0100 Subject: [PATCH] move checkAncestry method up --- .../fim/seibt/gitwrapper/repo/Commit.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java index 7c2ef1f..6848dd0 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java @@ -43,6 +43,19 @@ public class Commit extends Reference { super(repo, id); } + /** + * Checks if the given {@link Commit} is an ancestor of this commit. + * + * @param ancestor + * the {@link Commit} to check + * @return optionally <code>true</code>, if the given commit is in the history before this commit, + * <code>false</code>, if not and an {@link Optional#EMPTY empty optional}, if an error occurred. + */ + public Optional<Boolean> checkAncestry(Commit ancestor) { + return git.exec(repo.getDir(), " merge-base", "--is-ancestor", ancestor.getId(), id).map(execRes -> + execRes.exitCode == 0 ? Boolean.TRUE : execRes.exitCode == 1 ? Boolean.FALSE : null); + } + /** * Returns the author of this commit. * @@ -246,17 +259,4 @@ public class Commit extends Reference { } }); } - - /** - * Checks if the given {@link Commit} is an ancestor of this commit. - * - * @param ancestor - * the {@link Commit} to check - * @return optionally <code>true</code>, if the given commit is in the history before this commit, - * <code>false</code>, if not and an {@link Optional#EMPTY empty optional}, if an error occurred. - */ - public Optional<Boolean> checkAncestry(Commit ancestor) { - return git.exec(repo.getDir(), " merge-base", "--is-ancestor", ancestor.getId(), id).map(execRes -> - execRes.exitCode == 0 ? Boolean.TRUE : execRes.exitCode == 1 ? Boolean.FALSE : null); - } } -- GitLab