diff options
author | Josh Brown <sjoshbrown@google.com> | 2022-11-01 19:00:07 +0000 |
---|---|---|
committer | Josh Brown <sjoshbrown@google.com> | 2022-11-02 16:13:08 -0400 |
commit | 7b0a71a5e9916f0782eb24056a35b376373fdf59 (patch) | |
tree | 3ef7669b1e5d13d431b9c5ed6c65cbbade609f3f /org.eclipse.jgit | |
parent | e8068188f134b2b6a0d96314a3642154a1b66ab4 (diff) | |
download | jgit-7b0a71a5e9916f0782eb24056a35b376373fdf59.tar.gz jgit-7b0a71a5e9916f0782eb24056a35b376373fdf59.zip |
TransferConfig: Move reading advertisesid setting into TransferConfig
The config setting to enable advertising the session-id capability is
currently read in the ReceivePack class. This change moves it to a
common location in the TransferConfig class so that it can be reused
in other places like UploadPack. TransferConfig is also a more logical
place for the setting as it resides in the `transfer` config section.
Set the transfer.advertisesid setting to true to send the session-id
capability to the client.
Change-Id: If68ecb5e68b59f5c452a7992d02e3688b0a86747
Signed-off-by: Josh Brown <sjoshbrown@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java | 8 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java | 12 |
2 files changed, 13 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index fe01ecc1f3..816cec89af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -312,6 +312,7 @@ public class ReceivePack { TransferConfig tc = db.getConfig().get(TransferConfig.KEY); objectChecker = tc.newReceiveObjectChecker(); + allowReceiveClientSID = tc.isAllowReceiveClientSID(); ReceiveConfig rc = db.getConfig().get(ReceiveConfig::new); allowCreates = rc.allowCreates; @@ -320,7 +321,6 @@ public class ReceivePack { allowNonFastForwards = rc.allowNonFastForwards; allowOfsDelta = rc.allowOfsDelta; allowPushOptions = rc.allowPushOptions; - allowReceiveClientSID = rc.allowReceiveClientSID; maxCommandBytes = rc.maxCommandBytes; maxDiscardBytes = rc.maxDiscardBytes; advertiseRefsHook = AdvertiseRefsHook.DEFAULT; @@ -344,8 +344,6 @@ public class ReceivePack { final boolean allowPushOptions; - final boolean allowReceiveClientSID; - final long maxCommandBytes; final long maxDiscardBytes; @@ -361,10 +359,6 @@ public class ReceivePack { true); allowPushOptions = config.getBoolean("receive", "pushoptions", //$NON-NLS-1$ //$NON-NLS-2$ false); - // TODO: This should not be enabled until the corresponding change to - // upload pack has been implemented. - allowReceiveClientSID = config.getBoolean("transfer", //$NON-NLS-1$ - "advertisesid", false); //$NON-NLS-1$ maxCommandBytes = config.getLong("receive", //$NON-NLS-1$ "maxCommandBytes", //$NON-NLS-1$ 3 << 20); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java index 02be434887..805166a405 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java @@ -125,6 +125,8 @@ public class TransferConfig { private final boolean advertiseWaitForDone; private final boolean advertiseObjectInfo; + private final boolean allowReceiveClientSID; + final @Nullable ProtocolVersion protocolVersion; final String[] hideRefs; @@ -214,6 +216,8 @@ public class TransferConfig { "advertisewaitfordone", false); advertiseObjectInfo = rc.getBoolean("uploadpack", "advertiseobjectinfo", false); + allowReceiveClientSID = rc.getBoolean("transfer", "advertisesid", + false); } /** @@ -329,6 +333,14 @@ public class TransferConfig { } /** + * @return true to advertise and receive session-id capability + * @since 6.4 + */ + public boolean isAllowReceiveClientSID() { + return allowReceiveClientSID; + } + + /** * Get {@link org.eclipse.jgit.transport.RefFilter} respecting configured * hidden refs. * |