Merge "TransferConfig: Move reading advertisesid setting into TransferConfig"
This commit is contained in:
commit
16030da46f
|
@ -11,6 +11,8 @@
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.Test;
|
||||
|
@ -66,4 +68,19 @@ public void testParseProtocolInvalid() {
|
|||
TransferConfig tc = new TransferConfig(rc);
|
||||
assertNull(tc.protocolVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseAdvertiseSIDDefault() {
|
||||
Config rc = new Config();
|
||||
TransferConfig tc = new TransferConfig(rc);
|
||||
assertFalse(tc.isAllowReceiveClientSID());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseAdvertiseSIDSet() {
|
||||
Config rc = new Config();
|
||||
rc.setBoolean("transfer", null, "advertiseSID", true);
|
||||
TransferConfig tc = new TransferConfig(rc);
|
||||
assertTrue(tc.isAllowReceiveClientSID());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,6 +312,7 @@ public ReceivePack(Repository into) {
|
|||
|
||||
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 ReceivePack(Repository into) {
|
|||
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 @@ private static class ReceiveConfig {
|
|||
|
||||
final boolean allowPushOptions;
|
||||
|
||||
final boolean allowReceiveClientSID;
|
||||
|
||||
final long maxCommandBytes;
|
||||
|
||||
final long maxDiscardBytes;
|
||||
|
@ -361,10 +359,6 @@ private static class ReceiveConfig {
|
|||
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);
|
||||
|
|
|
@ -125,6 +125,8 @@ static ProtocolVersion parse(@Nullable String name) {
|
|||
private final boolean advertiseWaitForDone;
|
||||
private final boolean advertiseObjectInfo;
|
||||
|
||||
private final boolean allowReceiveClientSID;
|
||||
|
||||
final @Nullable ProtocolVersion protocolVersion;
|
||||
final String[] hideRefs;
|
||||
|
||||
|
@ -214,6 +216,8 @@ public TransferConfig(Config rc) {
|
|||
"advertisewaitfordone", false);
|
||||
advertiseObjectInfo = rc.getBoolean("uploadpack",
|
||||
"advertiseobjectinfo", false);
|
||||
allowReceiveClientSID = rc.getBoolean("transfer", "advertisesid",
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,6 +332,14 @@ public boolean isAdvertiseObjectInfo() {
|
|||
return advertiseObjectInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
|
|
Loading…
Reference in New Issue