Merge branch 'stable-7.2' into stable-7.3

* stable-7.2:
  Document JGit receive command size options
  Document receive.autogc configuration option
  Introduce fetch.autogc to disable concurrent GC upon fetches

Change-Id: I448a6c3738f23d2ab682d963f87c85ede26472dc
diff --git a/Documentation/config-options.md b/Documentation/config-options.md
index d4c010d..028cc0e 100644
--- a/Documentation/config-options.md
+++ b/Documentation/config-options.md
@@ -66,9 +66,10 @@
 
 ## __fetch__ options
 
-|  option | default | git option | description |
-|---------|---------|------------|-------------|
+| option                    | default | git option | description                                                                                                                                         |
+|---------------------------|---------|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
 | `fetch.useNegotiationTip` | `false` | ✅ | When enabled it restricts the client negotiation on unrelated branches i.e. only send haves for the refs that the client is interested in fetching. |
+| `fetch.autogc`            | `true`  | ⃞ | Perform an automatic garbage collection after the fetch operation has been completed.                                                               |
 
 ## __gc__ options
 
@@ -135,6 +136,16 @@
 | `pack.window` | `10` | ✅ | Number of objects to try when looking for a delta base per thread searching for deltas. |
 | `pack.windowMemory` | `0` (unlimited) | ✅ | Maximum number of bytes to put into the delta search window. |
 
+
+## __receive__ options
+
+| option           | default | git option | description                                                                                |
+|------------------|---------|------------|--------------------------------------------------------------------------------------------|
+| `receive.autogc` | `true`  | ✅ | Perform an automatic garbage collection after a receive-pack operation has been completed. |
+| `receive.maxCommandBytes` | `3 MiB` | ⃞ | Maximum number of bytes to read from the receive-pack command block before the pack data. If set to `0`, there is no limit. |
+| `receive.maxCommandDiscardBytes` | `-1` | ⃞ | Maximum number of command-block bytes to discard after `receive.maxCommandBytes` is exceeded, so JGit can report a side-band error before disconnecting. If set to `0`, there is no limit. If set to `-1`, JGit uses the larger of `3 * receive.maxCommandBytes` and `3 MiB`. |
+
+
 ## reftable options
 
 |  option | default | git option | description |
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
index ac76e83..f6def25 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -44,6 +44,7 @@
 import org.eclipse.jgit.hooks.Hooks;
 import org.eclipse.jgit.hooks.PrePushHook;
 import org.eclipse.jgit.internal.JGitText;
+import org.eclipse.jgit.lib.ConfigConstants;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.ObjectChecker;
 import org.eclipse.jgit.lib.ObjectId;
@@ -1457,7 +1458,10 @@ public FetchResult fetch(final ProgressMonitor monitor,
 		final FetchResult result = new FetchResult();
 		new FetchProcess(this, toFetch).execute(monitor, result, branch);
 
-		local.autoGC(monitor);
+		if (local.getConfig().getBoolean(ConfigConstants.CONFIG_FETCH_SECTION,
+			ConfigConstants.CONFIG_KEY_AUTOGC, true)) {
+			local.autoGC(monitor);
+		}
 
 		return result;
 	}