Skip to content

Commit

Permalink
cargo_new: drop the trailing slash for target exclusion in Git
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mathstuf committed Jan 15, 2018
1 parent 6a8eb71 commit f4e0eef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ fn mk(config: &Config, opts: &MkOptions) -> CargoResult<()> {
let name = opts.name;
let cfg = global_config(config)?;
// Please ensure that ignore and hgignore are in sync.
let ignore = ["\n", "/target/\n", "**/*.rs.bk\n",
let ignore = ["\n", "/target\n", "**/*.rs.bk\n",
if !opts.bin { "Cargo.lock\n" } else { "" }]
.concat();
// Mercurial glob ignores can't be rooted, so just sticking a 'syntax: glob' at the top of the
Expand Down

0 comments on commit f4e0eef

Please sign in to comment.