]> git.ipfire.org Git - thirdparty/git.git/blobdiff - transport.c
reftable: support preset file mode for writing
[thirdparty/git.git] / transport.c
index 17e9629710a2f8053c2657be91425b1aab840991..92ab9a3fa6b2d397c292c9e1605d1de56ec8940c 100644 (file)
@@ -1,7 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "transport.h"
-#include "run-command.h"
+#include "hook.h"
 #include "pkt-line.h"
 #include "fetch-pack.h"
 #include "remote.h"
@@ -162,12 +162,16 @@ static int fetch_refs_from_bundle(struct transport *transport,
                               int nr_heads, struct ref **to_fetch)
 {
        struct bundle_transport_data *data = transport->data;
+       struct strvec extra_index_pack_args = STRVEC_INIT;
        int ret;
 
+       if (transport->progress)
+               strvec_push(&extra_index_pack_args, "-v");
+
        if (!data->get_refs_from_bundle_called)
                get_refs_from_bundle(transport, 0, NULL);
        ret = unbundle(the_repository, &data->header, data->fd,
-                          transport->progress ? BUNDLE_VERBOSE : 0);
+                      &extra_index_pack_args);
        transport->hash_algo = data->header.hash_algo;
        return ret;
 }
@@ -883,12 +887,10 @@ static int disconnect_git(struct transport *transport)
 }
 
 static struct transport_vtable taken_over_vtable = {
-       NULL,
-       get_refs_via_connect,
-       fetch_refs_via_pack,
-       git_transport_push,
-       NULL,
-       disconnect_git
+       .get_refs_list  = get_refs_via_connect,
+       .fetch_refs     = fetch_refs_via_pack,
+       .push_refs      = git_transport_push,
+       .disconnect     = disconnect_git
 };
 
 void transport_take_over(struct transport *transport,
@@ -1032,21 +1034,17 @@ void transport_check_allowed(const char *type)
 }
 
 static struct transport_vtable bundle_vtable = {
-       NULL,
-       get_refs_from_bundle,
-       fetch_refs_from_bundle,
-       NULL,
-       NULL,
-       close_bundle
+       .get_refs_list  = get_refs_from_bundle,
+       .fetch_refs     = fetch_refs_from_bundle,
+       .disconnect     = close_bundle
 };
 
 static struct transport_vtable builtin_smart_vtable = {
-       NULL,
-       get_refs_via_connect,
-       fetch_refs_via_pack,
-       git_transport_push,
-       connect_git,
-       disconnect_git
+       .get_refs_list  = get_refs_via_connect,
+       .fetch_refs     = fetch_refs_via_pack,
+       .push_refs      = git_transport_push,
+       .connect        = connect_git,
+       .disconnect     = disconnect_git
 };
 
 struct transport *transport_get(struct remote *remote, const char *url)
@@ -1206,16 +1204,15 @@ static int run_pre_push_hook(struct transport *transport,
        struct ref *r;
        struct child_process proc = CHILD_PROCESS_INIT;
        struct strbuf buf;
-       const char *argv[4];
+       const char *hook_path = find_hook("pre-push");
 
-       if (!(argv[0] = find_hook("pre-push")))
+       if (!hook_path)
                return 0;
 
-       argv[1] = transport->remote->name;
-       argv[2] = transport->url;
-       argv[3] = NULL;
+       strvec_push(&proc.args, hook_path);
+       strvec_push(&proc.args, transport->remote->name);
+       strvec_push(&proc.args, transport->url);
 
-       proc.argv = argv;
        proc.in = -1;
        proc.trace2_hook_name = "pre-push";
 
@@ -1453,7 +1450,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs)
                        heads[nr_heads++] = rm;
        }
 
-       rc = transport->vtable->fetch(transport, nr_heads, heads);
+       rc = transport->vtable->fetch_refs(transport, nr_heads, heads);
 
        free(heads);
        return rc;