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
stable-3.1
Dave Borowitz 12 years ago
parent
commit
b4b84a84bd
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
  2. 9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

7
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java

@ -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;
}

9
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

@ -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