Skip to content

PathSource::list_files doesn't look at .gitignore if there's no package in the git root #1729

Closed
@alexcrichton

Description

@alexcrichton

Currently PathSource::list_files looks for packages where Repository::open will succeed, but this will never succeed if there is never a package at the root of a git repository. This means that filters such as pruning everything in .gitignore from the file listings will not work because no git repository is detected.

To replicate this behavior:

  • Create a git repository and change directories into it
  • cargo new a
  • cargo new b
  • Edit b to depend on a (as a path dependency)
  • Edit a to have a build script which creates the file a/foo in the git repository
  • Add a/foo to the repo's .gitignore

On re-running cargo build in the directory for b it will spuriously rebuild a too frequently as it doesn't know that it should ignore a/foo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions