Skip to content

Commit

Permalink
chore: fix target dir ignore in generated gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Mar 15, 2023
1 parent 4a3c588 commit 2a54f88
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> {
// Using the push method with multiple arguments ensures that the entries
// for all mutually-incompatible VCS in terms of syntax are in sync.
let mut ignore = IgnoreList::new();
ignore.push("/target", "^target/", "target");
ignore.push("/target/", "^target/", "target");
if !opts.bin {
ignore.push("/Cargo.lock", "^Cargo.lock$", "Cargo.lock");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/init/auto_git/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/target/
/Cargo.lock
2 changes: 1 addition & 1 deletion tests/testsuite/init/explicit_bin_with_git/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/target
/target/
2 changes: 1 addition & 1 deletion tests/testsuite/init/git_autodetect/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/target/
/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# Added by cargo

/target
/target/
/Cargo.lock
2 changes: 1 addition & 1 deletion tests/testsuite/init/inferred_bin_with_git/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/target
/target/
2 changes: 1 addition & 1 deletion tests/testsuite/init/inferred_lib_with_git/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/target/
/Cargo.lock
4 changes: 2 additions & 2 deletions tests/testsuite/init/simple_git/out/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/Cargo.lock
/target/
/Cargo.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/target/
**/some.file
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
/target/
**/some.file

# Added by cargo
Expand Down

0 comments on commit 2a54f88

Please sign in to comment.