If a filter is changed on a partial clone repository, for example from blob:none to blob:limit=1m, there is currently no straightforward way to bulk-refetch the objects that match the new filter for existing local commits. This is because the client will report commits as "have" during negotiation and any dependent objects won't be included in the transferred pack. Another use case is discussed at [1]. This patch series proposes adding a --refilter option to fetch & fetch-pack to enable doing a full fetch with a different filter, as if the local has no commits in common with the remote. It builds upon cbe566a071 ("negotiator/noop: add noop fetch negotiator", 2020-08-18). To note: 1. This will produce duplicated objects between the existing and newly fetched packs, but gc will clean them up. 2. This series doesn't check that there's a new filter in any way, whether configured via config or passed via --filter=. Personally I think that's fine. 3. If a user fetches with --refilter applying a more restrictive filter than previously (eg: blob:limit=1m then blob:limit=1k) the eventual state is a no-op, since any referenced object already in the local repository is never removed. Potentially this could be improved in future by more advanced gc, possibly along the lines discussed at [2]. [1] https://public-inbox.org/git/aa7b89ee-08aa-7943-6a00-28dcf344426e@xxxxxxxxxxx/ [2] https://public-inbox.org/git/A4BAD509-FA1F-49C3-87AF-CF4B73C559F1@xxxxxxxxx/ Robert Coup (6): fetch-negotiator: add specific noop initializor fetch-pack: add partial clone refiltering builtin/fetch-pack: add --refilter option fetch: add --refilter option t5615-partial-clone: add test for --refilter doc/partial-clone: mention --refilter option Documentation/fetch-options.txt | 9 ++++ Documentation/git-fetch-pack.txt | 4 ++ Documentation/technical/partial-clone.txt | 3 ++ builtin/fetch-pack.c | 4 ++ builtin/fetch.c | 18 ++++++- fetch-negotiator.c | 5 ++ fetch-negotiator.h | 8 ++++ fetch-pack.c | 57 +++++++++++++++-------- fetch-pack.h | 1 + remote-curl.c | 6 +++ t/t5616-partial-clone.sh | 42 ++++++++++++++++- transport-helper.c | 3 ++ transport.c | 4 ++ transport.h | 4 ++ 14 files changed, 146 insertions(+), 22 deletions(-) base-commit: 5d01301f2b865aa8dba1654d3f447ce9d21db0b5 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1138%2Frcoup%2Frc-partial-clone-refilter-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1138/rcoup/rc-partial-clone-refilter-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1138 -- gitgitgadget