diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDirectoryValue.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDirectoryValue.java index e646fafcceb26f..26366ddfee9f82 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDirectoryValue.java +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDirectoryValue.java @@ -125,7 +125,8 @@ public boolean equals(Object other) { return Objects.equal(path, otherValue.path) && Objects.equal(sourceDir, otherValue.sourceDir) && Arrays.equals(digest, otherValue.digest) - && Objects.equal(fileValues, otherValue.fileValues); + && Objects.equal(fileValues, otherValue.fileValues) + && Objects.equal(excludeFromVendoring, otherValue.excludeFromVendoring); } return false; } diff --git a/src/test/py/bazel/bzlmod/bazel_vendor_test.py b/src/test/py/bazel/bzlmod/bazel_vendor_test.py index 813c32d7025f5d..5a9bcaea355615 100644 --- a/src/test/py/bazel/bzlmod/bazel_vendor_test.py +++ b/src/test/py/bazel/bzlmod/bazel_vendor_test.py @@ -141,6 +141,25 @@ def testVendorFailsWithNofetch(self): 'ERROR: You cannot run the vendor command with --nofetch', stderr ) + def testVendorAfterFetch(self): + self.main_registry.createCcModule('aaa', '1.0') + self.ScratchFile( + 'MODULE.bazel', + [ + 'bazel_dep(name = "aaa", version = "1.0")', + 'local_path_override(module_name="bazel_tools", path="tools_mock")', + 'local_path_override(module_name="local_config_platform", ', + 'path="platforms_mock")', + ], + ) + self.ScratchFile('BUILD') + + self.RunBazel(['fetch', '--repo=@@aaa~']) + self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@@aaa~']) + + repos_vendored = os.listdir(self._test_cwd + '/vendor') + self.assertIn('aaa~', repos_vendored) + def testVendoringMultipleTimes(self): self.main_registry.createCcModule('aaa', '1.0') self.ScratchFile(