Merge branch 'nm/stash-untracked' into next
[gitweb.git] / sub-process.h
index e54621614518392b97438716c1532ba080553326..49701998c9bd663073244e64c4edd7e80991a3ef 100644 (file)
@@ -29,12 +29,22 @@ struct subprocess_entry {
        struct child_process process;
 };
 
+struct subprocess_capability {
+       const char *name;
+
+       /*
+        * subprocess_handshake will "|=" this value to supported_capabilities
+        * if the server reports that it supports this capability.
+        */
+       unsigned int flag;
+};
+
 /* subprocess functions */
 
 /* Function to test two subprocess hashmap entries for equality. */
 extern int cmd2process_cmp(const void *unused_cmp_data,
-                          const struct subprocess_entry *e1,
-                          const struct subprocess_entry *e2,
+                          const void *e1,
+                          const void *e2,
                           const void *unused_keydata);
 
 /*
@@ -62,6 +72,22 @@ static inline struct child_process *subprocess_get_child_process(
        return &entry->process;
 }
 
+/*
+ * Perform the version and capability negotiation as described in the "Long
+ * Running Filter Process" section of the gitattributes documentation using the
+ * given requested versions and capabilities. The "versions" and "capabilities"
+ * parameters are arrays terminated by a 0 or blank struct.
+ *
+ * This function is typically called when a subprocess is started (as part of
+ * the "startfn" passed to subprocess_start).
+ */
+int subprocess_handshake(struct subprocess_entry *entry,
+                        const char *welcome_prefix,
+                        int *versions,
+                        int *chosen_version,
+                        struct subprocess_capability *capabilities,
+                        unsigned int *supported_capabilities);
+
 /*
  * Helper function that will read packets looking for "status=<foo>"
  * key/value pairs and return the value from the last "status" packet