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

new: fix hgignore for real #4342

Merged
merged 1 commit into from
Jul 31, 2017
Merged

new: fix hgignore for real #4342

merged 1 commit into from
Jul 31, 2017

Conversation

sunshowers
Copy link
Contributor

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.

@rust-highfive
Copy link

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.

@sunshowers
Copy link
Contributor Author

(In case it helps, I've written a gitignore to hgignore translator. It's surprisingly tricky to get right.)

// 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 { "" }]
Copy link
Contributor Author

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.
@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@sunshowers
Copy link
Contributor Author

@alexcrichton any idea what happened to this? This might have been affected by the GH outage going on...

@alexcrichton
Copy link
Member

@bors: r+

hmm..

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 31, 2017

📌 Commit bef1f47 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 31, 2017

⌛ Testing commit bef1f47 with merge 6b18b35...

bors added a commit that referenced this pull request Jul 31, 2017
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.
@bors
Copy link
Contributor

bors commented Jul 31, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 6b18b35 to master...

@bors bors merged commit bef1f47 into rust-lang:master Jul 31, 2017
@ehuss ehuss added this to the 1.21.0 milestone Feb 6, 2022
weihanglo added a commit to weihanglo/cargo that referenced this pull request Feb 11, 2022
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.
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

Successfully merging this pull request may close these issues.

5 participants