Skip to content

Commit

Permalink
Auto merge of #14380 - jemtucker:fix-14379, r=epage
Browse files Browse the repository at this point in the history
Use longhand gitoxide path-spec patterns

Closes #14379
  • Loading branch information
bors committed Aug 12, 2024
2 parents f3fee6d + 9785142 commit 7ac34d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cargo/sources/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,11 @@ fn list_files_gix(

let pathspec = {
// Include the package root.
let mut include = BString::from(":/");
let mut include = BString::from(":(top)");
include.push_str(package_prefix.as_ref());

// Exclude the target directory.
let mut exclude = BString::from(":!/");
let mut exclude = BString::from(":!(exclude,top)");
exclude.push_str(target_prefix.as_ref());

vec![include, exclude]
Expand Down
24 changes: 23 additions & 1 deletion tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cargo_test_support::tools;
use cargo_test_support::{
basic_manifest, cargo_exe, cross_compile, is_coarse_mtime, project, project_in,
};
use cargo_test_support::{rustc_host, sleep_ms, slow_cpu_multiplier, symlink_supported};
use cargo_test_support::{git, rustc_host, sleep_ms, slow_cpu_multiplier, symlink_supported};
use cargo_util::paths::{self, remove_dir_all};

#[cargo_test]
Expand Down Expand Up @@ -5814,3 +5814,25 @@ fn links_overrides_with_target_applies_to_host() {
"#]])
.run();
}

#[cargo_test]
fn directory_with_leading_underscore() {
let p: cargo_test_support::Project = git::new("foo", |p| {
p.no_manifest()
.file(
"_foo/foo/Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
build = "build.rs"
"#,
)
.file("_foo/foo/src/main.rs", "fn main() {}")
.file("_foo/foo/build.rs", "fn main() { }")
});
p.cargo("build --manifest-path=_foo/foo/Cargo.toml -v")
.with_status(0)
.run();
}

0 comments on commit 7ac34d3

Please sign in to comment.