Re: [PATCH] fetch: allow adding a filter after initial clone.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 13, 2020, 20:43 UTC
- Message-ID
- <xmqqo8qrsh0d.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200513200040.68968-1-delphij@google.com>
Xin Li <delphij@google.com> writes:
(nothnig).
Can you help readers by describing what this change is about?
This space is reserved for the patch author to describe why this change is a good idea (if this patch is adding a new feature), what is already broken without this patch (if this patch is a bugfix), and why this change is a safe thing to do (if this patch lifts a limitation we had before that has been protecting us from getting into a bad state).
Show 28 quoted lines
> Signed-off-by: Xin Li <delphij@google.com>
> ---
> builtin/fetch.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index 3ae52c015d..e5faa17ecd 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1790,8 +1790,16 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
> if (depth || deepen_since || deepen_not.nr)
> deepen = 1;
>
> - if (filter_options.choice && !has_promisor_remote())
> - die("--filter can only be used when extensions.partialClone is set");
> + if (filter_options.choice && !has_promisor_remote()) {
> + char repo_version_string[10];
> +
> + xsnprintf(repo_version_string, sizeof(repo_version_string),
> + "%d", (int)GIT_REPO_VERSION);
> + git_config_set("core.repositoryformatversion",
> + repo_version_string);
> + git_config_set("extensions.partialclone", "origin");
> + promisor_remote_reinit();
> + }
>
> if (all) {
> if (argc == 1)