Feature Request: Support sparse-checkout to git_worker #13747
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
Description of the problem / feature request:
Recently, git.git has been adding feature to enable sparse-checkout possible.
This help reducing the amount of git-fetch data to a selected subset of trees and blob inside the repository instead of having to download all trees and blobs.
https://git-scm.com/docs/git-sparse-checkout
Feature requests: what underlying problem are you trying to solve with this feature?
In a multi-repo setup where a small repo A running Bazel depends on components in a relatively big repo B, it's undesirable that
git_repository(B)
in A has to download the entire checkout copy of big repo B. Leveraging git-sparse-checkout command, we can limit the download of B as well as the size-on-disk of B to be minimal.Add a
sparse_checkout_spec: List[str]
attribute ingit_repository()
rule that would enable git repositories to be fetchedwith sparse-checkout enabled.
Also added a
sparse_checkout_code_mode: bool
attribute, default totrue
ifsparse_checkout_spec
is none-empty that would enable sparse checkout code mode in git. This is a sensible mode that would include all the blobs in the parent trees of a dir insidesparse_checkout_spec
.Propose Implementation
In https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/git_worker.bzl
_update()
we can add an optional stageenable_sparse_checkout()
betweenadd_origin()
andfetch()
and execute the logic there.The text was updated successfully, but these errors were encountered: