path: root/Documentation/technical
diff options
authorJunio C Hamano <>2017-05-30 02:16:42 (GMT)
committerJunio C Hamano <>2017-05-30 02:16:42 (GMT)
commitae7785de0eab22c2f2f88871353bd468993aa482 (patch)
tree247869295849773c211a9cc56c53d28b092accf4 /Documentation/technical
parent7d5e13f652b4dfbf5e399dd2de32e5954368f0f8 (diff)
parent4f2a2e9f0e26c1c543d1f282d6e88b3d0f608d07 (diff)
Merge branch 'bp/sub-process-convert-filter'
Code from "conversion using external process" codepath has been extracted to a separate sub-process.[ch] module. * bp/sub-process-convert-filter: convert: update subprocess_read_status() to not die on EOF sub-process: move sub-process functions into separate files convert: rename reusable sub-process functions convert: update generic functions to only use generic data structures convert: separate generic structures and variables from the filter specific ones convert: split start_multi_file_filter() into two separate functions pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULL convert: move packet_write_line() into pkt-line as packet_writel() pkt-line: add packet_read_line_gently() pkt-line: fix packet_read_line() to handle len < 0 errors convert: remove erroneous tests for errno == EPIPE
Diffstat (limited to 'Documentation/technical')
1 files changed, 59 insertions, 0 deletions
diff --git a/Documentation/technical/api-sub-process.txt b/Documentation/technical/api-sub-process.txt
new file mode 100644
index 0000000..793508c
--- /dev/null
+++ b/Documentation/technical/api-sub-process.txt
@@ -0,0 +1,59 @@
+sub-process API
+The sub-process API makes it possible to run background sub-processes
+for the entire lifetime of a Git invocation. If Git needs to communicate
+with an external process multiple times, then this can reduces the process
+invocation overhead. Git and the sub-process communicate through stdin and
+The sub-processes are kept in a hashmap by command name and looked up
+via the subprocess_find_entry function. If an existing instance can not
+be found then a new process should be created and started. When the
+parent git command terminates, all sub-processes are also terminated.
+This API is based on the run-command API.
+Data structures
+* `struct subprocess_entry`
+The sub-process structure. Members should not be accessed directly.
+'int(*subprocess_start_fn)(struct subprocess_entry *entry)'::
+ User-supplied function to initialize the sub-process. This is
+ typically used to negotiate the interface version and capabilities.
+ Function to test two subprocess hashmap entries for equality.
+ Start a subprocess and add it to the subprocess hashmap.
+ Kill a subprocess and remove it from the subprocess hashmap.
+ Find a subprocess in the subprocess hashmap.
+ Get the underlying `struct child_process` from a subprocess.
+ Helper function to read packets looking for the last "status=<foo>"
+ key/value pair.