Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cargo/sources/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,11 @@ fn list_files_gix(
.filter(|res| {
// Don't include Cargo.lock if it is untracked. Packaging will
// generate a new one as needed.
// Also don't include untrackable directory entries, like FIFOs.
res.as_ref().map_or(true, |item| {
!(item.entry.status == Status::Untracked && item.entry.rela_path == "Cargo.lock")
item.entry.disk_kind != Some(gix::dir::entry::Kind::Untrackable)
&& !(item.entry.status == Status::Untracked
&& item.entry.rela_path == "Cargo.lock")
})
})
.map(|res| res.map(|item| (item.entry.rela_path, item.entry.disk_kind)))
Expand Down Expand Up @@ -751,7 +754,8 @@ fn list_files_walk(
for entry in walkdir {
match entry {
Ok(entry) => {
if !entry.file_type().is_dir() {
let file_type = entry.file_type();
if file_type.is_file() || file_type.is_symlink() {
ret.push(entry.into_path());
}
}
Expand Down
38 changes: 38 additions & 0 deletions tests/testsuite/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4221,3 +4221,41 @@ src/lib.rs
"#]])
.run();
}

#[cargo_test]
#[cfg(unix)]
fn simple_with_fifo() {
let git_project = git::new("foo", |project| {
project
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2015"
"#,
)
.file("src/main.rs", "fn main() {}")
});

std::process::Command::new("mkfifo")
.current_dir(git_project.root())
.arg(git_project.root().join("blocks-when-read"))
.status()
.expect("a FIFO can be created");

// Avoid actual blocking even in case of failure, assuming that what it lists here
// would also be read eventually.
git_project
.cargo("package -l")
.with_stdout_data(str![[r#"
.cargo_vcs_info.json
Cargo.lock
Cargo.toml
Cargo.toml.orig
src/main.rs

"#]])
.run();
}
35 changes: 35 additions & 0 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6873,3 +6873,38 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
"#]])
.run();
}

#[cargo_test]
#[cfg(unix)]
fn simple_with_fifo() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2015"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

std::process::Command::new("mkfifo")
.current_dir(p.root())
.arg(p.root().join("blocks-when-read"))
.status()
.expect("a FIFO can be created");

// Avoid actual blocking even in case of failure, assuming that what it lists here
// would also be read eventually.
p.cargo("package -l")
.with_stdout_data(str![[r#"
Cargo.lock
Cargo.toml
Cargo.toml.orig
src/main.rs

"#]])
.run();
}
Loading