]> git.ipfire.org Git - thirdparty/git.git/blobdiff - transport.c
push --force-with-lease: implement logic to populate old_sha1_expect[]
[thirdparty/git.git] / transport.c
index ba5d8afb1b04ba9d331c721fd9f730184fff2f23..5dd92b7801b4189f78112965f23ee16d49b15aad 100644 (file)
@@ -3,6 +3,8 @@
 #include "run-command.h"
 #include "pkt-line.h"
 #include "fetch-pack.h"
+#include "remote.h"
+#include "connect.h"
 #include "send-pack.h"
 #include "walker.h"
 #include "bundle.h"
@@ -534,6 +536,8 @@ static int fetch_refs_via_pack(struct transport *transport,
        args.quiet = (transport->verbose < 0);
        args.no_progress = !transport->progress;
        args.depth = data->options.depth;
+       args.check_self_contained_and_connected =
+               data->options.check_self_contained_and_connected;
 
        if (!data->got_remote_heads) {
                connect_setup(transport, 0, 0);
@@ -551,6 +555,8 @@ static int fetch_refs_via_pack(struct transport *transport,
                refs = NULL;
        data->conn = NULL;
        data->got_remote_heads = 0;
+       data->options.self_contained_and_connected =
+               args.self_contained_and_connected;
 
        free_refs(refs_tmp);
 
@@ -1136,6 +1142,12 @@ int transport_push(struct transport *transport,
                        return -1;
                }
 
+               if (transport->smart_options &&
+                   transport->smart_options->cas &&
+                   !is_empty_cas(transport->smart_options->cas))
+                       apply_push_cas(transport->smart_options->cas,
+                                      transport->remote, remote_refs);
+
                set_ref_status_for_push(remote_refs,
                        flags & TRANSPORT_PUSH_MIRROR,
                        flags & TRANSPORT_PUSH_FORCE);
@@ -1228,7 +1240,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs)
                 * then local and remote refs are likely to still be equal.
                 * Just feed them all to the fetch method in that case.
                 * This condition shouldn't be met in a non-deepening fetch
-                * (see builtin-fetch.c:quickfetch()).
+                * (see builtin/fetch.c:quickfetch()).
                 */
                heads = xmalloc(nr_refs * sizeof(*heads));
                for (rm = refs; rm; rm = rm->next)