Allow git_override to specify pathspec for --recurse_submodules #21186
Labels
help wanted
Someone outside the Bazel team could own this
P2
We'll consider working on this in future. (Assignee optional)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
Description of the feature request:
The feature request
We request to add an attribute to
git_override
:... or any solution that can allow us to pull only submodules with the given attribute to achieve the behavior of
git clone --recurse-submodules=':(attr:ddk)' ...
Which category does this issue belong to?
External Dependency
What underlying problem are you trying to solve with this feature?
Background
We (the Kleaf team) are working on a feature that needs to pull a subtree of a source tree as a module that builds a build number on ci.android.com. The way we design it is the following:
However, this will pull the whole superproject. We would like to be able to pull only projects with certain .gitattributes (example. These git attributes were originally from the
groups
of a repo manifest (example)So, to pull groups=ddk projects, with
repo
we would doWith Git submodules we would do
git clone --recurse-submodules=':(attr:ddk)' ...
However, there is no way to specify
--recurse-submodules=<pathspec>
ingit_override
.Alternatives
One may suggest us to use
use_repo_rule
and implement our own repo_rule instead. However, I need a full module so that bazel will read itsMODULE.bazel
and resolve the dependencies, not just a single repository.We also come up with some hacky alternative solutions, example:
where the
tools/filter_submodules.sh
contains:Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?release 7.0.2
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
Git pathspecs: https://css-tricks.com/git-pathspecs-and-how-to-use-them/#aa-attr
Git submodules: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---recurse-submodulesltpathspecgt
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: