> On 03 Aug 2016, at 20:30, Jakub Narębski <jnareb@xxxxxxxxx> wrote: > > ... > > > 2. HANDSHAKE (INITIALIZATION) > > Next, there is deciding on and designing the handshake between Git (between > Git command) and the filter driver process. With the `filter.<driver>.process` > solution the driver needs to tell which operations among (for now) "clean" > and "smudge" it does support. Plus it provides a way to extend protocol, > adding new features, like support for streaming, cleaning from file or > smudging to file, providing size upfront, perhaps even progress report. > > Current handshake consist of filter driver printing a signature, version > number and capabilities, in that order. Git checks that it is well formed > and matches expectations, and notes which of "clean" and "smudge" operations > are supported by the filter. > > There is no interaction from the Git side in the handshake, for example to > set options and expectations common to all files being filtered. Take > one possible extension of protocol: supporting streaming. The filter > driver needs to know whether it needs to read all the input, or whether > it can start printing output while input is incoming (e.g. to reduce > memory consumption)... though we may simply decide it to be next version > of the protocol. I would like to change the startup sequence to this: Git starts the filter when it encounters the first file that needs to be cleaned or smudged. After the filter started Git sends a welcome message, a list of supported protocol version numbers, and a flush packet. Git expects to read the welcome message and one protocol version number from the previously sent list. Afterwards Git sends a list of supported capabilities and a flush packet. Git expects to read a list of desired capabilities, which must be a subset of the supported capabilities list, and a flush packet as response: ------------------------ packet: git> git-filter-client packet: git> version=2 packet: git> version=42 packet: git> 0000 packet: git< git-filter-server packet: git< version=2 packet: git> clean=true packet: git> smudge=true packet: git> not-yet-invented=true packet: git> 0000 packet: git< clean=true packet: git< smudge=true packet: git< 0000 ------------------------ This would allow us to detect the case if a user configures an existing clean/smudge filter as `filter.<driver>.process`. Since Git is talking first, it would not "hang" in that case. Would that be ok with you? Thanks, Lars -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html