Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pletcher2015-04-16 19:47:15 +0000
committerDavid Pletcher2015-04-16 22:50:43 +0000
commit12e38d72758b486f19ccfa6c830d1ef95dfb1d11 (patch)
treeaa6d480c734fe05cb225fb04308d37ad3c39e7e7
parent41c4f9cb2a0f6754722409f373f6a1197f4d8820 (diff)
downloadjgit-12e38d72758b486f19ccfa6c830d1ef95dfb1d11.tar.gz
jgit-12e38d72758b486f19ccfa6c830d1ef95dfb1d11.tar.xz
jgit-12e38d72758b486f19ccfa6c830d1ef95dfb1d11.zip
Expose public getDepth method
The clone or fetch depth is a valuable bit of information for access logging. Create a public getter to faciliate access. A precondition check prevents unintentional misuse when the data isn't valid yet. Change-Id: I4603d5fd3bd4a767e3e2419b0f2da3664cfbd7f8 Signed-off-by: David Pletcher <dpletcher@google.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java13
1 files changed, 13 insertions, 0 deletions
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 1a653bd2be..51718c0279 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 @@ public class UploadPack {
}
}
+ /**
+ * 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;

Back to the top