Class HackPushNegotiateHook

  • All Implemented Interfaces:
    org.eclipse.jgit.transport.AdvertiseRefsHook

    public class HackPushNegotiateHook
    extends Object
    implements org.eclipse.jgit.transport.AdvertiseRefsHook
    Advertises part of history to git push clients.

    This is a hack to work around the lack of negotiation in the send-pack/receive-pack wire protocol.

    When the server is frequently advancing master by creating merge commits, the client may not be able to discover a common ancestor during push. Attempting to push will re-upload a very large amount of history. This hook hacks in a fake negotiation replacement by walking history and sending recent commits as ".have" lines in the wire protocol, allowing the client to find a common ancestor.

    • Constructor Detail

      • HackPushNegotiateHook

        public HackPushNegotiateHook()
    • Method Detail

      • advertiseRefs

        public void advertiseRefs​(org.eclipse.jgit.transport.UploadPack us)
        Specified by:
        advertiseRefs in interface org.eclipse.jgit.transport.AdvertiseRefsHook
      • advertiseRefs

        public void advertiseRefs​(org.eclipse.jgit.transport.BaseReceivePack rp)
                           throws org.eclipse.jgit.transport.ServiceMayNotContinueException
        Specified by:
        advertiseRefs in interface org.eclipse.jgit.transport.AdvertiseRefsHook
        Throws:
        org.eclipse.jgit.transport.ServiceMayNotContinueException