]> source.dussan.org Git - jgit.git/commitdiff
Provide a default implementation for set/get shallowCommits on DfsObjDatabase 84/195084/2
authorRonald Bhuleskar <funronald@google.com>
Fri, 5 Aug 2022 21:23:17 +0000 (14:23 -0700)
committerRonald Bhuleskar <funronald@google.com>
Fri, 5 Aug 2022 21:25:54 +0000 (17:25 -0400)
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

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java

index 46ec87df54c5b5ef5051b4ed2b6614a2a9c41953..c50e03869ccfb652675cfeb56eefb927c4336c3c 100644 (file)
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicReference;
 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 abstract class DfsObjDatabase extends ObjectDatabase {
                }
        };
 
+       private static final Set<ObjectId> shallowCommits = Collections.emptySet();
+
        /**
         * Sources for a pack file.
         * <p>
@@ -504,6 +507,19 @@ public abstract class DfsObjDatabase extends ObjectDatabase {
        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 {