]> source.dussan.org Git - jgit.git/commit
Introduce ProtocolV2Hook 77/122977/9
authorMasaya Suzuki <masayasuzuki@google.com>
Fri, 18 May 2018 17:06:56 +0000 (10:06 -0700)
committerMasaya Suzuki <masayasuzuki@google.com>
Thu, 16 Aug 2018 18:22:17 +0000 (11:22 -0700)
commit3aa2b8064c2f8d66e5c1a9e72014517ab4d4065a
treebe62dbf18006fca7d14d16d3d624110c0d12dd5f
parent62562295c0faea3de11bdfe67a35a704c37d9e0b
Introduce ProtocolV2Hook

In Git protocol v2, UploadPack and ReceivePack have the same
capabilities and can process any protocol v2 request. For example, a
client can sent a "fetch" command to the "/git-receive-pack" endpoint.

This makes it difficult for existing hook interfaces. For example,
PreUploadHook takes UploadPack, but a "fetch" command may be received by
ReceivePack.

To resolve this skew, this change introduce a different hook interface
for the protocol v2. The hook takes a request that is independent to the
handlers (UploadPack, ReceivePack). Also this makes it clear what
parameters the hook is counting on, instead of keep track of the hook
using getters from UploadPack / ReceivePack.

Bug: 534847
Change-Id: I71f3266584483db1e2b2edfc1a72d0bdf1bb6041
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/CapabilitiesV2Request.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Hook.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java