f05da2b48b
When cloning a repo with a --filter and with --recurse-submodules enabled, the partial clone filter only applies to the top-level repo. This can lead to unexpected bandwidth and disk usage for projects which include large submodules. For example, a user might wish to make a partial clone of Gerrit and would run: `git clone --recurse-submodules --filter=blob:5k https://gerrit.googlesource.com/gerrit`. However, only the superproject would be a partial clone; all the submodules would have all blobs downloaded regardless of their size. With this change, the same filter can also be applied to submodules, meaning the expected bandwidth and disk savings apply consistently. To avoid changing default behavior, add a new clone flag, `--also-filter-submodules`. When this is set along with `--filter` and `--recurse-submodules`, the filter spec is passed along to git-submodule and git-submodule--helper, such that submodule clones also have the filter applied. This applies the same filter to the superproject and all submodules. Users who need to customize the filter per-submodule would need to clone with `--no-recurse-submodules` and then manually initialize each submodule with the proper filter. Applying filters to submodules should be safe thanks to Jonathan Tan's recent work [1, 2, 3] eliminating the use of alternates as a method of accessing submodule objects, so any submodule object access now triggers a lazy fetch from the submodule's promisor remote if the accessed object is missing. This patch is a reworked version of [4], which was created prior to Jonathan Tan's work. [1]:8721e2e
(Merge branch 'jt/partial-clone-submodule-1', 2021-07-16) [2]:11e5d0a
(Merge branch 'jt/grep-wo-submodule-odb-as-alternate', 2021-09-20) [3]:162a13b
(Merge branch 'jt/no-abuse-alternate-odb-for-submodules', 2021-10-25) [4]: https://lore.kernel.org/git/52bf9d45b8e2b72ff32aa773f2415bf7b2b86da2.1563322192.git.steadmon@google.com/ Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 lines
564 B
Plaintext
14 lines
564 B
Plaintext
clone.defaultRemoteName::
|
|
The name of the remote to create when cloning a repository. Defaults to
|
|
`origin`, and can be overridden by passing the `--origin` command-line
|
|
option to linkgit:git-clone[1].
|
|
|
|
clone.rejectShallow::
|
|
Reject to clone a repository if it is a shallow one, can be overridden by
|
|
passing option `--reject-shallow` in command line. See linkgit:git-clone[1]
|
|
|
|
clone.filterSubmodules::
|
|
If a partial clone filter is provided (see `--filter` in
|
|
linkgit:git-rev-list[1]) and `--recurse-submodules` is used, also apply
|
|
the filter to submodules.
|