From 68daa28527afcca174fd92f161f70447b470612c Mon Sep 17 00:00:00 2001 From: Solly Ross Date: Mon, 25 Aug 2025 11:46:23 -0700 Subject: [PATCH] drop trailing slash in `mapped_manifest_dir` for git sources in git sources, when the repo root is the same as the manifest dir, currently reindeer with attempt to join the repo name with an empty path (the manifest sub-path), which produces a path with a trailing slash, due to how `Path::join` works. This path is later used to create the key in a buck2 file-to-source map-dict, which fails, since buck2 does not want trailing slashes in the keys for those maps. this detects if the manifest sub-path would be empty, and skips joining it. --- src/buckify.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/buckify.rs b/src/buckify.rs index 273f87e0..e9c4da61 100644 --- a/src/buckify.rs +++ b/src/buckify.rs @@ -459,7 +459,12 @@ fn generate_target_rules<'scope>( target: Name(format!("{}.git", short_name)), relative: BuckPath(path_within_repo.clone()), })); - PathBuf::from(short_name).join(path_within_repo) + let mut res = PathBuf::from(short_name); + if path_within_repo.components().next().is_some() { + // only do this if we have an actual path to avoid the trailing slash + res.push(path_within_repo) + } + res } else { PathBuf::from(format!("{}-{}.crate", pkg.name, pkg.version)) };