From: Ben Boeckel Date: Mon, 15 Jan 2018 22:07:56 +0000 (-0500) Subject: cargo_new: drop the trailing slash for target exclusion in Git X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~3^2~39^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f4e0eef11a92c32b6b13857a3c1ecdda2fda6478;p=cargo.git 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. --- diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 8fc52b4c6..c0d751d38 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -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