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