Browse Source

UploadPack: advertise allow-tip-sha1-in-want

This protocol capability, new in C git 1.8.2, corresponds to
RequestPolicy.TIP, so advertise it if that request policy was set.

Change-Id: I0d52af8a7747e951a87f060a5124f822ce1b2b26
tags/v3.1.0.201309270735-rc1
Dave Borowitz 11 years ago
parent
commit
b4b84a84bd

+ 7
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java View File

@@ -181,6 +181,13 @@ public abstract class BasePackFetchConnection extends BasePackConnection
*/
public static final String OPTION_NO_DONE = "no-done"; //$NON-NLS-1$

/**
* The client supports fetching objects at the tip of any ref, even if not
* advertised.
* @since 3.1
*/
public static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = "allow-tip-sha1-in-want"; //$NON-NLS-1$

static enum MultiAck {
OFF, CONTINUE, DETAILED;
}

+ 7
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java View File

@@ -90,6 +90,8 @@ import org.eclipse.jgit.util.io.TimeoutOutputStream;
* Implements the server side of a fetch connection, transmitting objects.
*/
public class UploadPack {
static final String OPTION_ALLOW_TIP_SHA1_IN_WANT = BasePackFetchConnection.OPTION_ALLOW_TIP_SHA1_IN_WANT;

static final String OPTION_INCLUDE_TAG = BasePackFetchConnection.OPTION_INCLUDE_TAG;

static final String OPTION_MULTI_ACK = BasePackFetchConnection.OPTION_MULTI_ACK;
@@ -122,8 +124,8 @@ public class UploadPack {
REACHABLE_COMMIT,

/**
* Client may ask for objects that are the tip of some reference, even if
* that reference wasn't advertised.
* Client may ask for objects that are the tip of any reference, even if not
* advertised.
* <p>
* This may happen, for example, when a custom {@link RefFilter} is set.
*/
@@ -722,6 +724,9 @@ public class UploadPack {
adv.advertiseCapability(OPTION_SHALLOW);
if (!biDirectionalPipe)
adv.advertiseCapability(OPTION_NO_DONE);
if (requestPolicy == RequestPolicy.TIP
|| requestPolicy == RequestPolicy.REACHABLE_COMMIT_TIP)
adv.advertiseCapability(OPTION_ALLOW_TIP_SHA1_IN_WANT);
adv.setDerefTags(true);
advertised = adv.send(getAdvertisedOrDefaultRefs());
adv.end();

Loading…
Cancel
Save