From 93318cbc8d45c6b25ea7010ee3954c8d3cd94c12 Mon Sep 17 00:00:00 2001 From: Andrew Olsen Date: Mon, 14 Feb 2022 09:38:51 +1300 Subject: [PATCH] Rename "refilter" to "repair" --- Documentation/fetch-options.txt | 13 +++++++------ Documentation/technical/partial-clone.txt | 2 +- builtin/fetch-pack.c | 4 ++-- builtin/fetch.c | 12 ++++++------ fetch-pack.c | 20 ++++++++++---------- fetch-pack.h | 2 +- t/t5616-partial-clone.sh | 10 +++++----- transport-helper.c | 4 ++-- transport.c | 6 +++--- transport.h | 6 +++--- 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index 004078bfea9188..5f0c5a3a711480 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -163,12 +163,13 @@ endif::git-pull[] setting. See linkgit:git-config[1]. ifndef::git-pull[] ---refilter:: - Reapply a partial clone filter from configuration or `--filter=`, such - as when the filter definition has changed. Instead of negotiating with - the server to avoid transferring commits and associated objects that are - already present locally, this option fetches all objects that match the - filter. +--repair:: + Fetch all objects that match the filter, regardless of current state. + Can be used to reapply a partial clone filter from configuration or + `--filter=`, such as when the filter definition has changed. Instead of + negotiating with the server to avoid transferring commits and associated + objects that are already present locally, this option fetches all objects + that match the filter. endif::git-pull[] --refmap=:: diff --git a/Documentation/technical/partial-clone.txt b/Documentation/technical/partial-clone.txt index e246b0778e5864..268939f781d42d 100644 --- a/Documentation/technical/partial-clone.txt +++ b/Documentation/technical/partial-clone.txt @@ -181,7 +181,7 @@ Fetching Missing Objects currently fetches all objects referred to by the requested objects, even though they are not necessary. -- Fetching with `--refilter` will request a complete new filtered packfile from +- Fetching with `--repair` will request a complete new filtered packfile from the remote, which can be used to change a filter without needing to dynamically fetch missing objects. diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index ad9786a5f9400a..7b4f5f93033a40 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -155,8 +155,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) args.from_promisor = 1; continue; } - if (!strcmp("--refilter", arg)) { - args.refilter = 1; + if (!strcmp("--repair", arg)) { + args.repair = 1; continue; } if (skip_prefix(arg, ("--" CL_ARG__FILTER "="), &arg)) { diff --git a/builtin/fetch.c b/builtin/fetch.c index 63c310190915d6..7c581a2975f13d 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -58,7 +58,7 @@ static int prune_tags = -1; /* unspecified */ static int all, append, dry_run, force, keep, multiple, update_head_ok; static int write_fetch_head = 1; -static int verbosity, deepen_relative, set_upstream, refilter; +static int verbosity, deepen_relative, set_upstream, repair; static int progress = -1; static int enable_auto_gc = 1; static int tags = TAGS_DEFAULT, unshallow, update_shallow, deepen; @@ -188,7 +188,7 @@ static struct option builtin_fetch_options[] = { OPT_SET_INT_F(0, "unshallow", &unshallow, N_("convert to a complete repository"), 1, PARSE_OPT_NONEG), - OPT_SET_INT_F(0, "refilter", &refilter, + OPT_SET_INT_F(0, "repair", &repair, N_("re-fetch with a modified filter"), 1, PARSE_OPT_NONEG), { OPTION_STRING, 0, "submodule-prefix", &submodule_prefix, N_("dir"), @@ -1288,13 +1288,13 @@ static int check_exist_and_connected(struct ref *ref_map) return -1; /* - * Similarly, if we need to refilter a partial clone we already have + * Similarly, if we need to repair a partial clone we already have * these commits reachable. Running rev-list here will return with * a good (0) exit status and we'll bypass the fetch that we * really need to perform. Claiming failure now will ensure * we perform the network exchange to reapply the filter. */ - if (refilter) + if (repair) return -1; @@ -1493,8 +1493,8 @@ static struct transport *prepare_transport(struct remote *remote, int deepen) set_option(transport, TRANS_OPT_DEEPEN_RELATIVE, "yes"); if (update_shallow) set_option(transport, TRANS_OPT_UPDATE_SHALLOW, "yes"); - if (refilter) - set_option(transport, TRANS_OPT_REFILTER, "yes"); + if (repair) + set_option(transport, TRANS_OPT_REPAIR, "yes"); if (filter_options.choice) { const char *spec = expand_list_objects_filter_spec(&filter_options); diff --git a/fetch-pack.c b/fetch-pack.c index 130b90150ef2c3..640b74b36ebfca 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -311,7 +311,7 @@ static int find_common(struct fetch_negotiator *negotiator, const char *remote_hex; struct object *o; - if (!args->refilter) { + if (!args->repair) { /* * If that object is complete (i.e. it is an ancestor of a * local ref), we tell them we have it but do not have to @@ -695,7 +695,7 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator, save_commit_buffer = 0; - if (args->refilter) + if (args->repair) return; trace2_region_enter("fetch-pack", "parse_remote_refs_and_find_cutoff", NULL); @@ -1024,7 +1024,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, int agent_len; struct fetch_negotiator negotiator_alloc; struct fetch_negotiator *negotiator; - unsigned is_refiltering = 0; + unsigned is_repairing = 0; sort_ref_list(&ref, ref_compare_name); QSORT(sought, nr_sought, cmp_ref_by_name); @@ -1094,12 +1094,12 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, if (server_supports("filter")) { server_supports_filtering = 1; print_verbose(args, _("Server supports %s"), "filter"); - } else if (args->filter_options.choice || args->refilter) { + } else if (args->filter_options.choice || args->repair) { warning("filtering not recognized by server, ignoring"); } - if (server_supports_filtering && args->refilter) { - is_refiltering = 1; + if (server_supports_filtering && args->repair) { + is_repairing = 1; } if (server_supports("deepen-since")) { @@ -1120,7 +1120,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, die(_("Server does not support this repository's object format")); negotiator = &negotiator_alloc; - if (is_refiltering) { + if (is_repairing) { fetch_negotiator_init_noop(negotiator); } else { fetch_negotiator_init(r, negotiator); @@ -1128,7 +1128,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, mark_complete_and_common_ref(negotiator, args, &ref); filter_refs(args, &ref, sought, nr_sought); - if (!is_refiltering && everything_local(args, &ref)) { + if (!is_repairing && everything_local(args, &ref)) { packet_flush(fd[1]); goto all_done; } @@ -1586,7 +1586,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, struct strvec index_pack_args = STRVEC_INIT; negotiator = &negotiator_alloc; - if (args->refilter) + if (args->repair) fetch_negotiator_init_noop(negotiator); else fetch_negotiator_init(r, negotiator); @@ -1615,7 +1615,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, /* Filter 'ref' by 'sought' and those that aren't local */ mark_complete_and_common_ref(negotiator, args, &ref); filter_refs(args, &ref, sought, nr_sought); - if (!args->refilter && everything_local(args, &ref)) + if (!args->repair && everything_local(args, &ref)) state = FETCH_DONE; else state = FETCH_SEND_REQUEST; diff --git a/fetch-pack.h b/fetch-pack.h index 68df2230c559ee..bbb663edda8887 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -42,7 +42,7 @@ struct fetch_pack_args { unsigned update_shallow:1; unsigned reject_shallow_remote:1; unsigned deepen:1; - unsigned refilter:1; + unsigned repair:1; /* * Indicate that the remote of this request is a promisor remote. The diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index f37be78626a737..0a4246948099f9 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -184,23 +184,23 @@ test_expect_success 'push new commits to server for file.4.txt' ' git -C src push -u srv main ' -# Do partial fetch to fetch smaller files; then verify that without --refilter +# Do partial fetch to fetch smaller files; then verify that without --repair # applying a new filter does not refetch missing large objects. Then use -# --refilter to apply the new filter on existing commits. Test it under both +# --repair to apply the new filter on existing commits. Test it under both # protocol v2 & v0. -test_expect_success 'apply a different filter using --refilter' ' +test_expect_success 'apply a different filter using --repair' ' git -C pc1 fetch --filter=blob:limit=999 origin && git -C pc1 rev-list --quiet --objects --missing=print \ main..origin/main >observed && test_line_count = 4 observed && - git -C pc1 fetch --filter=blob:limit=19999 --refilter origin && + git -C pc1 fetch --filter=blob:limit=19999 --repair origin && git -C pc1 rev-list --quiet --objects --missing=print \ main..origin/main >observed && test_line_count = 2 observed && git -c protocol.version=0 -C pc1 fetch --filter=blob:limit=29999 \ - --refilter origin && + --repair origin && git -C pc1 rev-list --quiet --objects --missing=print \ main..origin/main >observed && test_line_count = 0 observed diff --git a/transport-helper.c b/transport-helper.c index 6c86c5e1b1c690..797b6b0031f1a5 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -739,8 +739,8 @@ static int fetch_refs(struct transport *transport, if (data->transport_options.update_shallow) set_helper_option(transport, "update-shallow", "true"); - if (data->transport_options.refilter) - set_helper_option(transport, "refilter", "true"); + if (data->transport_options.repair) + set_helper_option(transport, "repair", "true"); if (data->transport_options.filter_options.choice) { const char *spec = expand_list_objects_filter_spec( diff --git a/transport.c b/transport.c index 71fc291f9489b8..40ca3d3b26b06a 100644 --- a/transport.c +++ b/transport.c @@ -243,8 +243,8 @@ static int set_git_option(struct git_transport_options *opts, list_objects_filter_die_if_populated(&opts->filter_options); parse_list_objects_filter(&opts->filter_options, value); return 0; - } else if (!strcmp(name, TRANS_OPT_REFILTER)) { - opts->refilter = !!value; + } else if (!strcmp(name, TRANS_OPT_REPAIR)) { + opts->repair = !!value; return 0; } else if (!strcmp(name, TRANS_OPT_REJECT_SHALLOW)) { opts->reject_shallow = !!value; @@ -380,7 +380,7 @@ static int fetch_refs_via_pack(struct transport *transport, args.update_shallow = data->options.update_shallow; args.from_promisor = data->options.from_promisor; args.filter_options = data->options.filter_options; - args.refilter = data->options.refilter; + args.repair = data->options.repair; args.stateless_rpc = transport->stateless_rpc; args.server_options = transport->server_options; args.negotiation_tips = data->options.negotiation_tips; diff --git a/transport.h b/transport.h index 40f92ea40f403f..3a8244f49453c6 100644 --- a/transport.h +++ b/transport.h @@ -16,7 +16,7 @@ struct git_transport_options { unsigned update_shallow : 1; unsigned reject_shallow : 1; unsigned deepen_relative : 1; - unsigned refilter : 1; + unsigned repair : 1; /* see documentation of corresponding flag in fetch-pack.h */ unsigned from_promisor : 1; @@ -217,8 +217,8 @@ void transport_check_allowed(const char *type); /* Filter objects for partial clone and fetch */ #define TRANS_OPT_LIST_OBJECTS_FILTER "filter" -/* Refilter a previous partial clone */ -#define TRANS_OPT_REFILTER "refilter" +/* Fetch everything that matches filter, regardless of current state */ +#define TRANS_OPT_REPAIR "repair" /* Request atomic (all-or-nothing) updates when pushing */ #define TRANS_OPT_ATOMIC "atomic"