added message to NoCommonHistoryException

This commit is contained in:
Sebastian Sdorra
2019-10-02 07:43:17 +02:00
parent 34177be6f7
commit a632350d32
2 changed files with 7 additions and 2 deletions

View File

@@ -8,7 +8,11 @@ import static java.util.Collections.emptyList;
public class NoCommonHistoryException extends BadRequestException {
public NoCommonHistoryException() {
super(emptyList(), "no common history");
this("no common history");
}
public NoCommonHistoryException(String message) {
super(emptyList(), message);
}
@Override

View File

@@ -735,7 +735,8 @@ public final class GitUtil
mergeBaseWalk.markStart(mergeBaseWalk.parseCommit(revision2));
RevCommit ancestor = mergeBaseWalk.next();
if (ancestor == null) {
throw new NoCommonHistoryException();
String msg = "revisions %s and %s are not related and therefore do not have a common ancestor";
throw new NoCommonHistoryException(String.format(msg, revision1.name(), revision2.name()));
}
return ancestor.getId();
}