Skip to content

Commit c5e21db

Browse files
committed
Auto merge of #4944 - mathstuf:better-gitignore-template, r=alexcrichton
cargo_new: drop the trailing slash for target exclusion in Git When `target` is a symlink (e.g., to keep build outputs on a separate partition), Git will not match the `/target/` ignore to the symlink since it is not a directory. Drop the trailing slash to support ignoring `target` as a symlink.
2 parents 078f491 + f4e0eef commit c5e21db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/ops/cargo_new.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn mk(config: &Config, opts: &MkOptions) -> CargoResult<()> {
404404
let name = opts.name;
405405
let cfg = global_config(config)?;
406406
// Please ensure that ignore and hgignore are in sync.
407-
let ignore = ["\n", "/target/\n", "**/*.rs.bk\n",
407+
let ignore = ["\n", "/target\n", "**/*.rs.bk\n",
408408
if !opts.bin { "Cargo.lock\n" } else { "" }]
409409
.concat();
410410
// Mercurial glob ignores can't be rooted, so just sticking a 'syntax: glob' at the top of the

0 commit comments

Comments
 (0)