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

[path] Also match parent dirs in include/exclude #4256

Closed
wants to merge 1 commit into from

Commits on Jul 7, 2017

  1. [path] Also match parent dirs in include/exclude

    NOTE: This is a major change in pattern matching for `include` and
    `exclude` fields, and can result in additional inclusion/exclusion for
    some patterns.
    
    Previously, for inclusion/exclusion matters, Cargo only works with paths
    of files in a package/repository, and glob pattern matching has been
    applying only to these file paths.
    
    The old behavior results in some unexpected behavior. For example,
    having:
    
    ```toml
    exclude = ["data"]
    ```
    
    in a manifest next to a `data` directory, it will not exclude the
    directory. To make it work, a pattern must be provided that matches the
    *files* under this directory, like:
    
    ```toml
    exclude = ["data/*"]
    ```
    
    To make Cargo's inclusion/exclusion behavior more intutional, and bring
    it on par with similar systems, like `gitignore`, we need to also match
    these patterns with the *directories*. The directories are seen
    internally as *parents* of the files. Therefore, this diff expands the
    pattern matching to files and their parent directories.
    
    Now, it's easier to exclude all data files:
    
    ```toml
    exclude = ["data"]
    ```
    
    or include only the `src` directory:
    
    ```toml
    include = ["src"]
    ```
    
    Fixes <rust-lang#3578>
    behnam committed Jul 7, 2017
    Configuration menu
    Copy the full SHA
    454cbd1 View commit details
    Browse the repository at this point in the history