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

[sources/path] Support leading slash in glob patterns #4378

Merged
merged 1 commit into from
Aug 9, 2017

Conversation

behnam
Copy link
Contributor

@behnam behnam commented Aug 7, 2017

Background: #4268

This diff takes us to Stage 1.1 of the migration plan by allowing
glob patterns to include a leading slash, so that glob patterns can be
updated, if needed, to start with a slash, closer to the future behavior
with gitignore-like matching.

Why is this stage needed?

It's common to have package.include set like this:

include = ["src/**"]

In old interpretation, this would only include all files under the src
directory under the package root. With the new interpretation, this
would match any path with some directory called src, even if it's not
directly under the package root.

After this patch, package owners can start marking glob patters with a
leading slash to fix the warning thrown, if any.

One thing to notice here is that there are no extra matchings, but, if
a manifest has already a pattern with a leading slash, this would
silently start matching it with the paths. I believe this is fine, since
the old behavior would have been for the pattern to not match anything,
therefore the item was useless.

See also #4377 for suggestion
to throw warning on useless/invalid patterns in these fields.

Background: rust-lang#4268

This diff takes us to **Stage 1.1** of the migration plan by allowing
glob patterns to include a leading slash, so that glob patterns can be
updated, if needed, to start with a slash, closer to the future behavior
with gitignore-like matching.

Why is this stage needed?

It's common to have `package.include` set like this:
```
include = ["src/**"]
```
In old interpretation, this would only include all files under the `src`
directory under the package root. With the new interpretation, this
would match any path with some directory called `src`, even if it's not
directly under the package root.

After this patch, package owners can start marking glob patters with a
leading slash to fix the warning thrown, if any.

One thing to notice here is that there are no extra matchings, but, if
a manifest has already a pattern with a leading slash, this would
silently start matching it with the paths. I believe this is fine, since
the old behavior would have been for the pattern to not match anything,
therefore the item was useless.

See also <rust-lang#4377> for suggestion
to throw warning on useless/invalid patterns in these fields.
@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@bors: r+

Thanks again for the continued work here @behnam! It's very much appreciated 💯

@bors
Copy link
Contributor

bors commented Aug 7, 2017

📌 Commit 5641cbd has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 8, 2017

⌛ Testing commit 5641cbd with merge 641bff8...

bors added a commit that referenced this pull request Aug 8, 2017
[sources/path] Support leading slash in glob patterns

Background: #4268

This diff takes us to **Stage 1.1** of the migration plan by allowing
glob patterns to include a leading slash, so that glob patterns can be
updated, if needed, to start with a slash, closer to the future behavior
with gitignore-like matching.

Why is this stage needed?

It's common to have `package.include` set like this:
```
include = ["src/**"]
```
In old interpretation, this would only include all files under the `src`
directory under the package root. With the new interpretation, this
would match any path with some directory called `src`, even if it's not
directly under the package root.

After this patch, package owners can start marking glob patters with a
leading slash to fix the warning thrown, if any.

One thing to notice here is that there are no extra matchings, but, if
a manifest has already a pattern with a leading slash, this would
silently start matching it with the paths. I believe this is fine, since
the old behavior would have been for the pattern to not match anything,
therefore the item was useless.

See also <#4377> for suggestion
to throw warning on useless/invalid patterns in these fields.
@behnam behnam closed this Aug 8, 2017
@behnam behnam deleted the ignore branch August 8, 2017 01:56
@behnam behnam restored the ignore branch August 8, 2017 05:28
@behnam behnam reopened this Aug 8, 2017
@behnam
Copy link
Contributor Author

behnam commented Aug 8, 2017

@bors: r=alexcrichton

@bors
Copy link
Contributor

bors commented Aug 8, 2017

@behnam: 🔑 Insufficient privileges: Not in reviewers

@behnam
Copy link
Contributor Author

behnam commented Aug 8, 2017

Sure, @alexcrichton!

BTW, looks like deleting my remote branch from CLI before it lands on master has bors/homu to stop the land process and needs another r+. Would you please stamp again?

@bors
Copy link
Contributor

bors commented Aug 8, 2017

💥 Test timed out

@behnam
Copy link
Contributor Author

behnam commented Aug 8, 2017

Also, @alexcrichton, I think this should be backported to rustc:1.20.0 release, as otherwise there could be plenty of warnings that users have no way to stop.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 9, 2017

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.
  • There's another pull request that is currently being tested, blocking this pull request: Stable metadata hashes across workspaces #3611

@bors
Copy link
Contributor

bors commented Aug 9, 2017

📌 Commit 5641cbd has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 9, 2017

⌛ Testing commit 5641cbd with merge 9d161a2...

bors added a commit that referenced this pull request Aug 9, 2017
[sources/path] Support leading slash in glob patterns

Background: #4268

This diff takes us to **Stage 1.1** of the migration plan by allowing
glob patterns to include a leading slash, so that glob patterns can be
updated, if needed, to start with a slash, closer to the future behavior
with gitignore-like matching.

Why is this stage needed?

It's common to have `package.include` set like this:
```
include = ["src/**"]
```
In old interpretation, this would only include all files under the `src`
directory under the package root. With the new interpretation, this
would match any path with some directory called `src`, even if it's not
directly under the package root.

After this patch, package owners can start marking glob patters with a
leading slash to fix the warning thrown, if any.

One thing to notice here is that there are no extra matchings, but, if
a manifest has already a pattern with a leading slash, this would
silently start matching it with the paths. I believe this is fine, since
the old behavior would have been for the pattern to not match anything,
therefore the item was useless.

See also <#4377> for suggestion
to throw warning on useless/invalid patterns in these fields.
@bors
Copy link
Contributor

bors commented Aug 9, 2017

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

@bors bors merged commit 5641cbd into rust-lang:master Aug 9, 2017
@behnam behnam deleted the ignore branch August 11, 2017 01:45
@ehuss ehuss added this to the 1.21.0 milestone Feb 6, 2022
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