diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/transport-helper.c | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/transport-helper.c')
-rw-r--r-- | third_party/git/transport-helper.c | 58 |
1 files changed, 15 insertions, 43 deletions
diff --git a/third_party/git/transport-helper.c b/third_party/git/transport-helper.c index 20a7185ec40e..6b05a88faf59 100644 --- a/third_party/git/transport-helper.c +++ b/third_party/git/transport-helper.c @@ -33,16 +33,6 @@ struct helper_data { check_connectivity : 1, no_disconnect_req : 1, no_private_update : 1; - - /* - * As an optimization, the transport code may invoke fetch before - * get_refs_list. If this happens, and if the transport helper doesn't - * support connect or stateless_connect, we need to invoke - * get_refs_list ourselves if we haven't already done so. Keep track of - * whether we have invoked get_refs_list. - */ - unsigned get_refs_list_called : 1; - char *export_marks; char *import_marks; /* These go from remote name (as in "list") to private name */ @@ -404,12 +394,11 @@ static int fetch_with_fetch(struct transport *transport, sendline(data, &buf); while (1) { - const char *name; - if (recvline(data, &buf)) exit(128); - if (skip_prefix(buf.buf, "lock ", &name)) { + if (starts_with(buf.buf, "lock ")) { + const char *name = buf.buf + 5; if (transport->pack_lockfile) warning(_("%s also locked %s"), data->name, name); else @@ -436,7 +425,6 @@ static int get_importer(struct transport *transport, struct child_process *fasti child_process_init(fastimport); fastimport->in = xdup(helper->out); argv_array_push(&fastimport->args, "fast-import"); - argv_array_push(&fastimport->args, "--allow-unsafe-features"); argv_array_push(&fastimport->args, debug ? "--stats" : "--quiet"); if (data->bidi_import) { @@ -664,25 +652,17 @@ static int connect_helper(struct transport *transport, const char *name, return 0; } -static struct ref *get_refs_list_using_list(struct transport *transport, - int for_push); - static int fetch(struct transport *transport, int nr_heads, struct ref **to_fetch) { struct helper_data *data = transport->data; int i, count; - get_helper(transport); - if (process_connect(transport, 0)) { do_take_over(transport); return transport->vtable->fetch(transport, nr_heads, to_fetch); } - if (!data->get_refs_list_called) - get_refs_list_using_list(transport, 0); - count = 0; for (i = 0; i < nr_heads; i++) if (!(to_fetch[i]->status & REF_STATUS_UPTODATE)) @@ -702,9 +682,13 @@ static int fetch(struct transport *transport, set_helper_option(transport, "update-shallow", "true"); if (data->transport_options.filter_options.choice) { - const char *spec = expand_list_objects_filter_spec( - &data->transport_options.filter_options); - set_helper_option(transport, "filter", spec); + struct strbuf expanded_filter_spec = STRBUF_INIT; + expand_list_objects_filter_spec( + &data->transport_options.filter_options, + &expanded_filter_spec); + set_helper_option(transport, "filter", + expanded_filter_spec.buf); + strbuf_release(&expanded_filter_spec); } if (data->transport_options.negotiation_tips) @@ -856,10 +840,6 @@ static void set_common_push_options(struct transport *transport, die(_("helper %s does not support --signed=if-asked"), name); } - if (flags & TRANSPORT_PUSH_ATOMIC) - if (set_helper_option(transport, TRANS_OPT_ATOMIC, "true") != 0) - die(_("helper %s does not support --atomic"), name); - if (flags & TRANSPORT_PUSH_OPTIONS) { struct string_list_item *item; for_each_string_list_item(item, transport->push_options) @@ -1079,19 +1059,6 @@ static int has_attribute(const char *attrs, const char *attr) static struct ref *get_refs_list(struct transport *transport, int for_push, const struct argv_array *ref_prefixes) { - get_helper(transport); - - if (process_connect(transport, for_push)) { - do_take_over(transport); - return transport->vtable->get_refs_list(transport, for_push, ref_prefixes); - } - - return get_refs_list_using_list(transport, for_push); -} - -static struct ref *get_refs_list_using_list(struct transport *transport, - int for_push) -{ struct helper_data *data = transport->data; struct child_process *helper; struct ref *ret = NULL; @@ -1099,9 +1066,13 @@ static struct ref *get_refs_list_using_list(struct transport *transport, struct ref *posn; struct strbuf buf = STRBUF_INIT; - data->get_refs_list_called = 1; helper = get_helper(transport); + if (process_connect(transport, for_push)) { + do_take_over(transport); + return transport->vtable->get_refs_list(transport, for_push, ref_prefixes); + } + if (data->push && for_push) write_str_in_full(helper->in, "list for-push\n"); else @@ -1148,6 +1119,7 @@ static struct ref *get_refs_list_using_list(struct transport *transport, } static struct transport_vtable vtable = { + 0, set_helper_option, get_refs_list, fetch, |