Throw not found exceptions for log between branches

This commit is contained in:
René Pfeuffer
2019-03-11 14:17:03 +01:00
parent ec2aff6aa9
commit 28d7467e18
2 changed files with 33 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ import org.eclipse.jgit.treewalk.filter.PathFilter;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.NotFoundException;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.GitChangesetConverter;
@@ -206,6 +207,9 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
if (!Strings.isNullOrEmpty(request.getAncestorChangeset())) {
ancestorId = repository.resolve(request.getAncestorChangeset());
if (ancestorId == null) {
throw notFound(entity("Revision", request.getAncestorChangeset()).in(this.repository));
}
}
revWalk = new RevWalk(repository);
@@ -245,6 +249,8 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
break;
}
}
} else if (ancestorId != null) {
throw notFound(entity("Revision", request.getBranch()).in(this.repository));
}
if (branch != null) {
@@ -263,6 +269,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
{
throw notFound(entity("Revision", e.getObjectId().getName()).in(repository));
}
catch (NotFoundException e)
{
throw e;
}
catch (Exception ex)
{
throw new InternalRepositoryException(repository, "could not create change log", ex);