blob: 6f33654b4288d4effafed8a78162da9da2bf7f9a [file] [log] [blame]
Junio C Hamano640779d2018-02-14 01:29:141Long-running process protocol
2=============================
3
4This protocol is used when Git needs to communicate with an external
5process throughout the entire life of a single Git command. All
Junio C Hamano04495a12022-08-18 21:13:086communication is in pkt-line format (see linkgit:gitprotocol-common[5])
Junio C Hamano640779d2018-02-14 01:29:147over standard input and standard output.
8
9Handshake
10---------
11
12Git starts by sending a welcome message (for example,
13"git-filter-client"), a list of supported protocol version numbers, and
14a flush packet. Git expects to read the welcome message with "server"
15instead of "client" (for example, "git-filter-server"), exactly one
16protocol version number from the previously sent list, and a flush
17packet. All further communication will be based on the selected version.
18The remaining protocol description below documents "version=2". Please
19note that "version=42" in the example below does not exist and is only
20there to illustrate how the protocol would look like with more than one
21version.
22
23After the version negotiation Git sends a list of all capabilities that
24it supports and a flush packet. Git expects to read a list of desired
25capabilities, which must be a subset of the supported capabilities list,
26and a flush packet as response:
27------------------------
28packet: git> git-filter-client
29packet: git> version=2
30packet: git> version=42
31packet: git> 0000
32packet: git< git-filter-server
33packet: git< version=2
34packet: git< 0000
35packet: git> capability=clean
36packet: git> capability=smudge
37packet: git> capability=not-yet-invented
38packet: git> 0000
39packet: git< capability=clean
40packet: git< capability=smudge
41packet: git< 0000
42------------------------
43
44Shutdown
45--------
46
47Git will close
48the command pipe on exit. The filter is expected to detect EOF
49and exit gracefully on its own. Git will wait until the filter
50process has stopped.