From: Robert Coup <robert@xxxxxxxxxxx> Add a --refilter option to fetch-pack to force a full fetch when applying a new filter. Signed-off-by: Robert Coup <robert@xxxxxxxxxxx> --- Documentation/git-fetch-pack.txt | 4 ++++ builtin/fetch-pack.c | 4 ++++ remote-curl.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt index c9758847937..ad21c627d75 100644 --- a/Documentation/git-fetch-pack.txt +++ b/Documentation/git-fetch-pack.txt @@ -101,6 +101,10 @@ be in a separate packet, and the list must end with a flush packet. current shallow boundary instead of from the tip of each remote branch history. +--refilter:: + Skips negotiating commits with the server in order to reapply a new + partial clone filter and fetch all matching objects. + --no-progress:: Do not show the progress. diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index c2d96f4c89a..eb478929236 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -153,6 +153,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) args.from_promisor = 1; continue; } + if (!strcmp("--refilter", arg)) { + args.refilter = 1; + continue; + } if (skip_prefix(arg, ("--" CL_ARG__FILTER "="), &arg)) { parse_list_objects_filter(&args.filter_options, arg); continue; diff --git a/remote-curl.c b/remote-curl.c index 0dabef2dd7c..0679f71e935 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -43,6 +43,7 @@ struct options { /* see documentation of corresponding flag in fetch-pack.h */ from_promisor : 1, + refilter : 1, atomic : 1, object_format : 1, force_if_includes : 1; @@ -198,6 +199,9 @@ static int set_option(const char *name, const char *value) } else if (!strcmp(name, "from-promisor")) { options.from_promisor = 1; return 0; + } else if (!strcmp(name, "refilter")) { + options.refilter = 1; + return 0; } else if (!strcmp(name, "filter")) { options.filter = xstrdup(value); return 0; @@ -1182,6 +1186,8 @@ static int fetch_git(struct discovery *heads, strvec_push(&args, "--deepen-relative"); if (options.from_promisor) strvec_push(&args, "--from-promisor"); + if (options.refilter) + strvec_push(&args, "--refilter"); if (options.filter) strvec_pushf(&args, "--filter=%s", options.filter); strvec_push(&args, url.buf); -- gitgitgadget