-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
new: fix hgignore for real #4342
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
(In case it helps, I've written a gitignore to hgignore translator. It's surprisingly tricky to get right.) |
src/cargo/ops/cargo_new.rs
Outdated
// 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 { "^Cargo.lock\n" } else { "" }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to root Cargo.lock
files? I did here, but we can easily drop that too.
There was an attempt to fix hgignore in rust-lang#4158, but unfortunately the fix was incorrect -- hgignore glob syntax is not in fact identical to gitignore syntax. To get rooted ignores in Mercurial we must use the regex-based syntax, so we have no choice but to define a separate set of ignores.
@bors: r+ Thanks! |
@alexcrichton any idea what happened to this? This might have been affected by the GH outage going on... |
@bors: r+ hmm.. |
@bors: r+ |
📌 Commit bef1f47 has been approved by |
new: fix hgignore for real There was an attempt to fix hgignore in #4158, but unfortunately the fix was incorrect -- hgignore glob syntax is not in fact identical to gitignore syntax. To get rooted ignores in Mercurial we must use the regex-based syntax, so we have no choice but to define a separate set of ignores.
☀️ Test successful - status-appveyor, status-travis |
Have traced down the issue. It feel like the original intent is to ignore `Cargo.lock` and `target` at project root but not subdirectories. 1. The original implementation did ignore root `/Cargo.lock`. rust-lang#321 2. Someday one wanted to support both gitignore and hgingore's syntax and removed the leading slash. rust-lang#1247 3. Later, one found that we should not ignore `target` other than under root directory and added `/target` back. rust-lang#4099 4. It turns out that the syntax is not compatible between gitignore and hgignore. Therefore, one started to use hgignore special syntax to handle `Cargo.lock`. rust-lang#4342 This commit rollbacks to what original implementation tries to do.
There was an attempt to fix hgignore in #4158, but unfortunately the fix
was incorrect -- hgignore glob syntax is not in fact identical to
gitignore syntax.
To get rooted ignores in Mercurial we must use the regex-based syntax,
so we have no choice but to define a separate set of ignores.