Provide a default implementation for set/get shallowCommits on DfsObjDatabase

Jgit change https://git.eclipse.org/r/c/jgit/jgit/+/193329 adds an implementation for get/set shallow commits in ObjectDatabase. This failed gerrit's acceptance tests since there is no default implementation for them in DfsObjDatabase.

Change-Id: I649db9ae679ec2606cf7c530b040f8b6b93eb81a
This commit is contained in:
Ronald Bhuleskar 2022-08-05 14:23:17 -07:00
parent 1c7b4a580f
commit 05a2485075
1 changed files with 16 additions and 0 deletions

View File

@ -29,6 +29,7 @@
import org.eclipse.jgit.internal.storage.pack.PackExt;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ObjectReader;
@ -57,6 +58,8 @@ public void markDirty() {
}
};
private static final Set<ObjectId> shallowCommits = Collections.emptySet();
/**
* Sources for a pack file.
* <p>
@ -504,6 +507,19 @@ protected abstract ReadableChannel openFile(
protected abstract DfsOutputStream writeFile(
DfsPackDescription desc, PackExt ext) throws IOException;
@Override
public Set<ObjectId> getShallowCommits() throws IOException {
return shallowCommits;
}
@Override
public void setShallowCommits(Set<ObjectId> shallowCommits) {
if (!shallowCommits.isEmpty()) {
throw new UnsupportedOperationException(
"Shallow commits expected to be empty.");
}
}
void addPack(DfsPackFile newPack) throws IOException {
PackList o, n;
do {