Skip to content

Building git_override module with strip_prefix finds too many files #26628

Closed

Description

@brandonchinn178

Description of the bug:

Say I have a Bazel repo with a module in a subdirectory:

|-- MODULE.bazel
|-- module-foo/
    |-- MODULE.bazel
    |-- BUILD.bazel
|-- other-project/
    |-- BUILD.bazel

In another repo, I do

bazel_dep(name = "foo")
git_override(
    module_name = "foo",
    remote = "...",
    commit = "...",
    strip_prefix = "module-foo/",
)

I would expect bazel build @foo//... to only build module-foo/BUILD.bazel, but instead, I get errors talking about @@foo~//.tmp_git_root/other-project.

I can workaround by adding .tmp_git_root to module-foo/.bazelignore, but that seems like a hack

EDIT: If I build in module-foo/ beforehand, I also need to exclude bazel-module-foo

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development 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 ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

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

No response

Activity

  1. added
    untriaged
    on Jul 24, 2025
  2. added
    team-ExternalDeps
    team-Core
    on Jul 25, 2025
  3. added
    P2
    and removed
    untriaged
    on Jul 29, 2025
  4. added 2 commits that reference this issue on Jul 29, 2026
    a125189
    42e7be7
  5. added 2 commits that reference this issue on Aug 21, 2026
    df63836
    b375715
  6. added a commit that references this issue on Sep 9, 2026
    d4e306a
  7. added a commit that references this issue on Dec 4, 2026
    c1bd962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2team-Coreteam-ExternalDepstype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions