Skip to content

Commit

Permalink
chore: Add more info for missing object id in commit indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
robinshine committed Sep 24, 2024
1 parent f70038d commit ae8b295
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import io.onedev.commons.loader.ManagedSerializedForm;
import io.onedev.commons.utils.FileUtils;
import io.onedev.commons.utils.PathUtils;
import io.onedev.commons.utils.StringUtils;
import io.onedev.commons.utils.TarUtils;
import io.onedev.commons.utils.*;
import io.onedev.k8shelper.KubernetesHelper;
import io.onedev.server.OneDev;
import io.onedev.server.cluster.ClusterManager;
Expand Down Expand Up @@ -46,6 +43,7 @@
import jetbrains.exodus.env.Transaction;
import jetbrains.exodus.env.TransactionalComputable;
import org.apache.commons.lang3.SerializationUtils;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
Expand Down Expand Up @@ -1040,7 +1038,13 @@ private void collect(Long projectId) {
refs.addAll(projectManager.getRepository(projectId).getRefDatabase().getRefsByPrefix(Constants.R_TAGS));

for (Ref ref : refs) {
RevObject revObj = revWalk.peel(revWalk.parseAny(ref.getObjectId()));
RevObject revObj;
try {
revObj = revWalk.peel(revWalk.parseAny(ref.getObjectId()));
} catch (MissingObjectException e) {
var message = String.format("%s (project id: %d, ref: %s)", e.getMessage(), projectId, ref.getName());
throw new ExplicitException(message);
}
if (revObj instanceof RevCommit) {
RevCommit commit = (RevCommit) revObj;
works.add(new CollectingWork(PRIORITY, commit.copy(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static CoverageReport parse(Build build, Document doc, TaskLogger logger)
}
}

var pair = parsePackageCoverage("[no name]", projectElement.elements("file"), build, logger);
var pair = parsePackageCoverage("[root]", projectElement.elements("file"), build, logger);
var packageCoverage = pair.getLeft();
if (!packageCoverage.getFileCoverages().isEmpty()) {
packageCoverages.add(packageCoverage);
Expand Down

0 comments on commit ae8b295

Please sign in to comment.