path: root/Documentation
diff options
authorBen Peart <>2017-05-05 15:28:01 (GMT)
committerJunio C Hamano <>2017-05-15 04:01:57 (GMT)
commit99605d62e8e7e568035dc953b24b79b3d52f0522 (patch)
tree4a55a99f460e16e0b2bbcce036f3611534357f5c /Documentation
parentf514d7d177f7cabbacc3f2cda96ca211266ac2ff (diff)
sub-process: move sub-process functions into separate files
Move the sub-proces functions into sub-process.h/c. Add documentation for the new module in Documentation/technical/api-sub-process.txt Signed-off-by: Ben Peart <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation')
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.