Support shallow fetch through net.git-fetch-with-cli
(original) (raw)
Problem
#13285 tracks the ability of fetching registry index and git dependencies in “shallow fetch” mode. We have both libgit2 and gitoxide backend supporting this. Our third git backend, the famous "git" CLI, hasn't yet supported the feature.
During the discussion of stabilizing shallow fetch on Zulip, we would like to see net.git-fetch-with-cli have this feature as well, for a better consistency among each git backend.
Proposed Solution
The function drives git CLI is fetch_with_cli. Need to
- Pass the correct flags to
git
to replicate whatfetch_with_gitoxide
andfetch_with_libgit2
have done for shallow fetches. - Ensure the cloned/fetched/checkouted repositories be in correct locations.
Currently they should be under~/.cargo/git/{db,checkout}/*-shallow
, and~/.cargo/registry/index/*-shallow
- Shallow cloned repository created from one backend must be usable for other backends.
Notes
No response