From 63f6d8281771860e22efc6b8f4718dedf9bd0b7a Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 15 Mar 2023 14:31:08 +0000 Subject: [PATCH] chore: fix target in generated hg ignore file --- src/cargo/ops/cargo_new.rs | 2 +- tests/testsuite/init/mercurial_autodetect/out/.hgignore | 2 +- tests/testsuite/init/simple_hg/out/.hgignore | 2 +- tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 7fa667364742..0e432e2fe4ca 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -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"); } diff --git a/tests/testsuite/init/mercurial_autodetect/out/.hgignore b/tests/testsuite/init/mercurial_autodetect/out/.hgignore index 1ae6a78bbc9f..0cc56e7ff73a 100644 --- a/tests/testsuite/init/mercurial_autodetect/out/.hgignore +++ b/tests/testsuite/init/mercurial_autodetect/out/.hgignore @@ -1,2 +1,2 @@ -^target/ +^target$ ^Cargo.lock$ diff --git a/tests/testsuite/init/simple_hg/out/.hgignore b/tests/testsuite/init/simple_hg/out/.hgignore index 1ae6a78bbc9f..0cc56e7ff73a 100644 --- a/tests/testsuite/init/simple_hg/out/.hgignore +++ b/tests/testsuite/init/simple_hg/out/.hgignore @@ -1,2 +1,2 @@ -^target/ +^target$ ^Cargo.lock$ diff --git a/tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore b/tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore index 2ab1fce0101b..dd9ddffeb23a 100644 --- a/tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore +++ b/tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore @@ -2,5 +2,5 @@ # Added by cargo -^target/ +^target$ ^Cargo.lock$