Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore /target instead of any target #3997

Closed
behnam opened this issue May 5, 2017 · 3 comments
Closed

Ignore /target instead of any target #3997

behnam opened this issue May 5, 2017 · 3 comments

Comments

@behnam
Copy link
Contributor

behnam commented May 5, 2017

When creating a .gitignore file with this line:

target

it will ignore any file/dir named target anywhere in the repo. Meaning, this would also ignore /src/target/, a submodule, and all its content.

To resolve this problem, we should instead ignore the target dir on the top level:

/target

and, if we want to make sure it's only ignored if a dir:

/target/

What do you think?

@alexcrichton
Copy link
Member

This has come up a few times before (#3158, #2565, #1952, #1415), but it seems surprising enough that something needs to change! Mind taking a look at some of those linked issues and see if it changes things?

@behnam
Copy link
Contributor Author

behnam commented Aug 11, 2017

So, this was not an issue before, because target would only match the path in root. But, now that we're in the migration to gitignore-style matching, we will need to update this after State 1.1 of the migration makes it to beta or stable channels.

Keeping this issue open as a tracker for this specific of the migration.

@behnam
Copy link
Contributor Author

behnam commented Aug 30, 2017

This is already addressed in master:

// Please ensure that ignore and hgignore are in sync.
let ignore = ["/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
// file will exclude too much. Instead, use regexp-based ignores. See 'hg help ignore' for
// more.
let hgignore = ["^target/\n", "glob:*.rs.bk\n",
if !opts.bin { "glob:Cargo.lock\n" } else { "" }]
.concat();

PR: #4099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants