Browse Source

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>
stable-4.1
David Pletcher 10 years ago
parent
commit
12e38d7275
  1. 13
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

13
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;

Loading…
Cancel
Save