mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
addad10594
Separating out the implementation of the handshake when starting a
long-running subprocess (for example, as is done for a clean/smudge
filter) was done in commit fa64a2fdbe
("sub-process: refactor
handshake to common function", 2017-07-26), but its documentation still
resides in gitattributes. Split out the documentation as well.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
50 lines
1.9 KiB
Text
50 lines
1.9 KiB
Text
Long-running process protocol
|
|
=============================
|
|
|
|
This protocol is used when Git needs to communicate with an external
|
|
process throughout the entire life of a single Git command. All
|
|
communication is in pkt-line format (see technical/protocol-common.txt)
|
|
over standard input and standard output.
|
|
|
|
Handshake
|
|
---------
|
|
|
|
Git starts by sending a welcome message (for example,
|
|
"git-filter-client"), a list of supported protocol version numbers, and
|
|
a flush packet. Git expects to read the welcome message with "server"
|
|
instead of "client" (for example, "git-filter-server"), exactly one
|
|
protocol version number from the previously sent list, and a flush
|
|
packet. All further communication will be based on the selected version.
|
|
The remaining protocol description below documents "version=2". Please
|
|
note that "version=42" in the example below does not exist and is only
|
|
there to illustrate how the protocol would look like with more than one
|
|
version.
|
|
|
|
After the version negotiation Git sends a list of all capabilities that
|
|
it supports 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< 0000
|
|
packet: git> capability=clean
|
|
packet: git> capability=smudge
|
|
packet: git> capability=not-yet-invented
|
|
packet: git> 0000
|
|
packet: git< capability=clean
|
|
packet: git< capability=smudge
|
|
packet: git< 0000
|
|
------------------------
|
|
|
|
Shutdown
|
|
--------
|
|
|
|
Git will close
|
|
the command pipe on exit. The filter is expected to detect EOF
|
|
and exit gracefully on its own. Git will wait until the filter
|
|
process has stopped.
|