Documentation / technical / long-running-process-protocol.txton commit Merge branch 'en/t5407-rebase-m-fix' (3467e25)
   1Long-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
   6communication is in pkt-line format (see technical/protocol-common.txt)
   7over 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.