BaseReceivePack: Add hasReceivedPack method

The getPackSize method will throw IllegalStateException if it is
called when the pack size is not set. This is the case for example
when the received commands are all DELETE and there is no pack.

Add a new method hasReceivedPack that can be called prior to calling
getPackSize, to avoid causing the IllegalStateException.

See [1] for context.

[1] https://bugs.chromium.org/p/gerrit/issues/detail?id=11918

Change-Id: I56397256a05e92c8398e65c07a859cee59b46317
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
index 40c76cd..ae0c220 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
@@ -1069,6 +1069,20 @@
 	}
 
 	/**
+	 * Get whether or not a pack has been received.
+	 *
+	 * This can be called before calling {@link #getPackSize()} to avoid causing
+	 * {@code IllegalStateException} when the pack size was not set because no
+	 * pack was received.
+	 *
+	 * @return true if a pack has been received.
+	 * @since 5.6
+	 */
+	public boolean hasReceivedPack() {
+		return packSize != null;
+	}
+
+	/**
 	 * Get the size of the received pack file including the index size.
 	 *
 	 * This can only be called if the pack is already received.