Skip to content

Commit fdd35e4

Browse files
committed
chore: fix target dir ignore in generated gitignore
1 parent 4a3c588 commit fdd35e4

File tree

12 files changed

+13
-13
lines changed

12 files changed

+13
-13
lines changed

Diff for: src/cargo/ops/cargo_new.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> {
742742
// Using the push method with multiple arguments ensures that the entries
743743
// for all mutually-incompatible VCS in terms of syntax are in sync.
744744
let mut ignore = IgnoreList::new();
745-
ignore.push("/target", "^target/", "target");
745+
ignore.push("/target/", "^target/", "target");
746746
if !opts.bin {
747747
ignore.push("/Cargo.lock", "^Cargo.lock$", "Cargo.lock");
748748
}

Diff for: tests/testsuite/init/auto_git/out/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
/Cargo.lock
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/target
1+
/target/

Diff for: tests/testsuite/init/git_autodetect/out/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
/Cargo.lock

Diff for: tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# Added by cargo
44

5-
/target
5+
/target/
66
/Cargo.lock
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/target
1+
/target/
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
/Cargo.lock

Diff for: tests/testsuite/init/pijul_autodetect/out/.ignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
/Cargo.lock

Diff for: tests/testsuite/init/simple_git/out/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
/Cargo.lock
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/target
1+
/target/
22
**/some.file
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/target
1+
/target/
22
**/some.file
33

44
# Added by cargo
55
#
66
# already existing elements were commented out
77

8-
#/target
8+
#/target/
99
/Cargo.lock

Diff for: tests/testsuite/new.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn simple_git() {
9595

9696
let fp = paths::root().join("foo/.gitignore");
9797
let contents = fs::read_to_string(&fp).unwrap();
98-
assert_eq!(contents, "/target\n/Cargo.lock\n",);
98+
assert_eq!(contents, "/target/\n/Cargo.lock\n",);
9999

100100
cargo_process("build").cwd(&paths::root().join("foo")).run();
101101
}

0 commit comments

Comments
 (0)