aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java6
7 files changed, 31 insertions, 14 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
index ffea980f11..d1e5446827 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
@@ -142,7 +142,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
rp.setAdvertiseRefsHook(new AdvertiseRefsHook() {
@Override
public void advertiseRefs(ReceivePack rp2)
- throws ServiceMayNotContinueException {
+ throws IOException {
rp.setAdvertisedRefs(rp.getRepository().getAllRefs(),
null);
new HidePrivateHook().advertiseRefs(rp);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index fecced1ae6..9cdea597f9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -420,9 +420,11 @@ public class FileRepository extends Repository {
* advertise that it safely has that other repository's references, without
* exposing any other details about the other repository. This may help a
* client trying to push changes avoid pushing more than it needs to.
+ *
+ * @throws IOException
*/
@Override
- public Set<ObjectId> getAdditionalHaves() {
+ public Set<ObjectId> getAdditionalHaves() throws IOException {
return getAdditionalHaves(null);
}
@@ -438,8 +440,11 @@ public class FileRepository extends Repository {
* Set of AlternateHandle Ids already seen
*
* @return unmodifiable collection of other known objects.
+ * @throws IOException
+ * if getting refs hits an IO error
*/
- private Set<ObjectId> getAdditionalHaves(Set<AlternateHandle.Id> skips) {
+ private Set<ObjectId> getAdditionalHaves(Set<AlternateHandle.Id> skips)
+ throws IOException {
HashSet<ObjectId> r = new HashSet<>();
skips = objectDatabase.addMe(skips);
for (AlternateHandle d : objectDatabase.myAlternates()) {
@@ -447,7 +452,7 @@ public class FileRepository extends Repository {
FileRepository repo;
repo = ((AlternateRepository) d).repository;
- for (Ref ref : repo.getAllRefs().values()) {
+ for (Ref ref : repo.getRefDatabase().getRefs()) {
if (ref.getObjectId() != null)
r.add(ref.getObjectId());
if (ref.getPeeledObjectId() != null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index 1e8a6c9175..2d1aca8de1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -1051,13 +1051,14 @@ public abstract class Repository implements AutoCloseable {
* <p>
* When a repository borrows objects from another repository, it can
* advertise that it safely has that other repository's references, without
- * exposing any other details about the other repository. This may help
- * a client trying to push changes avoid pushing more than it needs to.
+ * exposing any other details about the other repository. This may help a
+ * client trying to push changes avoid pushing more than it needs to.
*
* @return unmodifiable collection of other known objects.
+ * @throws IOException
*/
@NonNull
- public Set<ObjectId> getAdditionalHaves() {
+ public Set<ObjectId> getAdditionalHaves() throws IOException {
return Collections.emptySet();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java
index ed900121be..fb9c14576a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AbstractAdvertiseRefsHook.java
@@ -42,6 +42,7 @@
package org.eclipse.jgit.transport;
+import java.io.IOException;
import java.util.Map;
import java.util.Set;
@@ -65,10 +66,12 @@ public abstract class AbstractAdvertiseRefsHook implements AdvertiseRefsHook {
uploadPack.getRepository(), uploadPack.getRevWalk()));
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public void advertiseRefs(ReceivePack receivePack)
- throws ServiceMayNotContinueException {
+ throws IOException {
Map<String, Ref> refs = getAdvertisedRefs(receivePack.getRepository(),
receivePack.getRevWalk());
Set<ObjectId> haves = getAdvertisedHaves(receivePack.getRepository(),
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java
index eb1aef9ad7..84c36915a2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHook.java
@@ -42,6 +42,8 @@
package org.eclipse.jgit.transport;
+import java.io.IOException;
+
/**
* Hook to allow callers to take over advertising refs to the client.
*
@@ -89,8 +91,9 @@ public interface AdvertiseRefsHook {
* if necessary.
* @throws org.eclipse.jgit.transport.ServiceMayNotContinueException
* abort; the message will be sent to the user.
+ * @throws IOException
* @since 5.6
*/
void advertiseRefs(ReceivePack receivePack)
- throws ServiceMayNotContinueException;
+ throws ServiceMayNotContinueException, IOException;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java
index 91bdf58e7a..eb9c673ef3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AdvertiseRefsHookChain.java
@@ -10,6 +10,7 @@
package org.eclipse.jgit.transport;
+import java.io.IOException;
import java.util.List;
/**
@@ -49,10 +50,12 @@ public class AdvertiseRefsHookChain implements AdvertiseRefsHook {
}
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public void advertiseRefs(ReceivePack rp)
- throws ServiceMayNotContinueException {
+ throws IOException {
for (int i = 0; i < count; i++)
hooks[i].advertiseRefs(rp);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
index 871ba50a6c..2542105c07 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
@@ -440,9 +440,10 @@ public class ReceivePack {
* explicit set of additional haves to claim as advertised. If
* null, assumes the default set of additional haves from the
* repository.
+ * @throws IOException
*/
public void setAdvertisedRefs(Map<String, Ref> allRefs,
- Set<ObjectId> additionalHaves) {
+ Set<ObjectId> additionalHaves) throws IOException {
refs = allRefs != null ? allRefs : getAllRefs();
refs = refFilter.filter(refs);
advertisedHaves.clear();
@@ -1187,8 +1188,9 @@ public class ReceivePack {
* Get advertised refs, or the default if not explicitly advertised.
*
* @return advertised refs, or the default if not explicitly advertised.
+ * @throws IOException
*/
- private Map<String, Ref> getAdvertisedOrDefaultRefs() {
+ private Map<String, Ref> getAdvertisedOrDefaultRefs() throws IOException {
if (refs == null)
setAdvertisedRefs(null, null);
return refs;