sha1_file: add raw_object_store argument to alt_odb_usable
[gitweb.git] / transport.h
index ab4fe7f277480853a66867a11ee9432588de30ac..3c68d73b215bbabc81a75a810b1083697bfd6329 100644 (file)
@@ -4,6 +4,7 @@
 #include "cache.h"
 #include "run-command.h"
 #include "remote.h"
+#include "list-objects-filter-options.h"
 
 struct string_list;
 
@@ -15,12 +16,15 @@ struct git_transport_options {
        unsigned self_contained_and_connected : 1;
        unsigned update_shallow : 1;
        unsigned deepen_relative : 1;
+       unsigned from_promisor : 1;
+       unsigned no_dependents : 1;
        int depth;
        const char *deepen_since;
        const struct string_list *deepen_not;
        const char *uploadpack;
        const char *receivepack;
        struct push_cas_option *cas;
+       struct list_objects_filter_options filter_options;
 };
 
 enum transport_family {
@@ -30,6 +34,8 @@ enum transport_family {
 };
 
 struct transport {
+       const struct transport_vtable *vtable;
+
        struct remote *remote;
        const char *url;
        void *data;
@@ -59,58 +65,6 @@ struct transport {
         */
        const struct string_list *push_options;
 
-       /**
-        * Returns 0 if successful, positive if the option is not
-        * recognized or is inapplicable, and negative if the option
-        * is applicable but the value is invalid.
-        **/
-       int (*set_option)(struct transport *connection, const char *name,
-                         const char *value);
-
-       /**
-        * Returns a list of the remote side's refs. In order to allow
-        * the transport to try to share connections, for_push is a
-        * hint as to whether the ultimate operation is a push or a fetch.
-        *
-        * If the transport is able to determine the remote hash for
-        * the ref without a huge amount of effort, it should store it
-        * in the ref's old_sha1 field; otherwise it should be all 0.
-        **/
-       struct ref *(*get_refs_list)(struct transport *transport, int for_push);
-
-       /**
-        * Fetch the objects for the given refs. Note that this gets
-        * an array, and should ignore the list structure.
-        *
-        * If the transport did not get hashes for refs in
-        * get_refs_list(), it should set the old_sha1 fields in the
-        * provided refs now.
-        **/
-       int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
-
-       /**
-        * Push the objects and refs. Send the necessary objects, and
-        * then, for any refs where peer_ref is set and
-        * peer_ref->new_oid is different from old_oid, tell the
-        * remote side to update each ref in the list from old_oid to
-        * peer_ref->new_oid.
-        *
-        * Where possible, set the status for each ref appropriately.
-        *
-        * The transport must modify new_sha1 in the ref to the new
-        * value if the remote accepted the change. Note that this
-        * could be a different value from peer_ref->new_oid if the
-        * process involved generating new commits.
-        **/
-       int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
-       int (*connect)(struct transport *connection, const char *name,
-                      const char *executable, int fd[2]);
-
-       /** get_refs_list(), fetch(), and push_refs() can keep
-        * resources (such as a connection) reserved for further
-        * use. disconnect() releases these resources.
-        **/
-       int (*disconnect)(struct transport *connection);
        char *pack_lockfile;
        signed verbose : 3;
        /**
@@ -209,6 +163,18 @@ void transport_check_allowed(const char *type);
 /* Send push certificates */
 #define TRANS_OPT_PUSH_CERT "pushcert"
 
+/* Indicate that these objects are being fetched by a promisor */
+#define TRANS_OPT_FROM_PROMISOR "from-promisor"
+
+/*
+ * Indicate that only the objects wanted need to be fetched, not their
+ * dependents
+ */
+#define TRANS_OPT_NO_DEPENDENTS "no-dependents"
+
+/* Filter objects for partial clone and fetch */
+#define TRANS_OPT_LIST_OBJECTS_FILTER "filter"
+
 /**
  * Returns 0 if the option was used, non-zero otherwise. Prints a
  * message to stderr if the option is not used.