Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sparse-checkout option to git repository rules #24069

Open
anthonymahshigian opened this issue Oct 23, 2024 · 3 comments
Open

Add a sparse-checkout option to git repository rules #24069

anthonymahshigian opened this issue Oct 23, 2024 · 3 comments
Labels
help wanted Someone outside the Bazel team could own this P3 We're not considering working on this, but happy to review a PR. (No assignee) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request

Comments

@anthonymahshigian
Copy link

Description of the feature request:

Hi there! I'm requesting that git_override (in bzlmod) be expanded to add a sparse-checkout option. This could be done relatively easy with a custom repository rule back with Workspace, but now with bzlmod I'm hoping to not have to use a module extension to achieve this.
https://bazel.build/rules/lib/globals/module#git_override

Which category does this issue belong to?

External Dependency

What underlying problem are you trying to solve with this feature?

I am dealing with a very large repository, and using the current git_override rule is not feasible.

Which operating system are you running Bazel on?

n/a

What is the output of bazel info release?

n/a

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

n/a

What's the output of git remote get-url origin; git rev-parse HEAD ?

n/a

Have you found anything relevant by searching the web?

I found #13747 that requests a similar feature for git_repository.

Any other information, logs, or outputs that you want to share?

I don't believe this would be too difficult. The additional inputs would be a list of repository paths to checkout (passed down to git). We would also have to enforce the system's git is a minimum version. I'd be happy to take a stab at it myself if someone could confirm this as a valuable addition and point me to the code to modify.

@meteorcloudy
Copy link
Member

@lberki Do you think this is doable only for git_repository?

@meteorcloudy meteorcloudy added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Oct 29, 2024
@lberki
Copy link
Contributor

lberki commented Oct 29, 2024

I'm not entirely sure what "only for git_repository" means, but it looks like git_worker.bzl calls out to the git command line tool, so it should be implementable in git_repository() and git_override uses that, so I think the answer to you question is "yes"?

@meteorcloudy meteorcloudy added the help wanted Someone outside the Bazel team could own this label Oct 30, 2024
@meteorcloudy
Copy link
Member

Yes, the scope is much smaller than adding native support of git sparse-checkout in Bazel. So contribution is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Someone outside the Bazel team could own this P3 We're not considering working on this, but happy to review a PR. (No assignee) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants