Skip to content

Commit 722d8f1

Browse files
committed
Add target folder but not committed
1 parent 4577c0e commit 722d8f1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/testsuite/package.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use cargo_test_support::paths::CargoPathExt;
44
use cargo_test_support::publish::validate_crate_contents;
55
use cargo_test_support::registry::{self, Package};
66
use cargo_test_support::{
7-
basic_manifest, cargo_process, git, path2url, paths, project, project_in, symlink_supported, t,
7+
basic_manifest, cargo_process, git, path2url, paths, project, symlink_supported, t,
88
ProjectBuilder,
99
};
1010
use flate2::read::GzDecoder;
@@ -3162,9 +3162,10 @@ src/main.rs
31623162
fn include_files_called_target_git() {
31633163
// https://github.com/rust-lang/cargo/issues/12790
31643164
// files and folders called "target" should be included, unless they're the actual target directory
3165-
let (p, repo) = git::new_repo("all", |p| init_and_add_inner_target(p));
3165+
let (p, repo) = git::new_repo("target_uncommitted", |p| init_and_add_inner_target(p));
31663166
// add target folder but not committed.
3167-
let _ = project_in(&repo.path().display().to_string()).file("target/foo.txt", "");
3167+
let _ = fs::create_dir_all(&repo.workdir().unwrap().join("target/foo.txt")).unwrap();
3168+
31683169
p.cargo("package -l")
31693170
.with_stdout(
31703171
"\
@@ -3182,7 +3183,7 @@ src/main.rs
31823183
.run();
31833184

31843185
// if target is committed, it should be include.
3185-
let p = git::new("all", |p| {
3186+
let p = git::new("target_committed", |p| {
31863187
init_and_add_inner_target(p).file("target/foo.txt", "")
31873188
});
31883189
p.cargo("package -l")

0 commit comments

Comments
 (0)