]>
Commit | Line | Data |
---|---|---|
addad105 JT |
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 technical/protocol-common.txt) | |
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 | packet: git> git-filter-client | |
29 | packet: git> version=2 | |
30 | packet: git> version=42 | |
31 | packet: git> 0000 | |
32 | packet: git< git-filter-server | |
33 | packet: git< version=2 | |
34 | packet: git< 0000 | |
35 | packet: git> capability=clean | |
36 | packet: git> capability=smudge | |
37 | packet: git> capability=not-yet-invented | |
38 | packet: git> 0000 | |
39 | packet: git< capability=clean | |
40 | packet: git< capability=smudge | |
41 | packet: git< 0000 | |
42 | ------------------------ | |
43 | ||
44 | Shutdown | |
45 | -------- | |
46 | ||
47 | Git will close | |
48 | the command pipe on exit. The filter is expected to detect EOF | |
49 | and exit gracefully on its own. Git will wait until the filter | |
50 | process has stopped. |