diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 1a653bd2b..51718c027 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -884,6 +884,19 @@ private void recvWants() throws IOException { } } + /** + * Returns the clone/fetch depth. Valid only after calling recvWants(). + * + * @return the depth requested by the client, or 0 if unbounded. + * @since 4.0 + */ + public int getDepth() { + if (options == null) { + throw new IllegalStateException("do not call getDepth() before recvWants()"); + } + return depth; + } + private boolean negotiate() throws IOException { okToGiveUp = Boolean.FALSE;