Annotate the exception with the possible failure reason when Bitmaps are not enabled.

When bitmaps are not enabled the RevWalk is expensive. AllowFilter
provides an override to continue walking. PedestrianWalk can be
expensive and fails when the clone is a partial clone using
--filter=tree:0. This can only work when bitmaps are enabled.

Having a message to the exception improves debuggability of such cases.

Change-Id: Ie61de20a39a765e6f6f77e81b4c3bbda2eefbaf3
This commit is contained in:
Ronald Bhuleskar 2022-04-20 10:28:30 -07:00
parent 5868543f17
commit 7f4fa5655a
1 changed files with 7 additions and 1 deletions

View File

@ -2023,7 +2023,8 @@ private static void checkNotAdvertisedWants(UploadPack up,
.filter(obj -> !(obj instanceof RevCommit))
.limit(1)
.collect(Collectors.toList()).get(0);
throw new WantNotValidException(nonCommit);
throw new WantNotValidException(nonCommit,
new Exception("Cannot walk without bitmaps")); //$NON-NLS-1$
}
try (ObjectWalk objWalk = walk.toObjectWalkWithSameObjects()) {
@ -2037,6 +2038,11 @@ private static void checkNotAdvertisedWants(UploadPack up,
Optional<RevObject> unreachable = reachabilityChecker
.areAllReachable(wantsAsObjs, startersAsObjs);
if (unreachable.isPresent()) {
if (!repoHasBitmaps) {
throw new WantNotValidException(
unreachable.get(), new Exception(
"Retry with bitmaps enabled")); //$NON-NLS-1$
}
throw new WantNotValidException(unreachable.get());
}
}