doorstop-dev / doorstop

Requirements management using version control.
https://doorstop.readthedocs.io
Other
467 stars 128 forks source link

Git VCS class parses gitignore files differently from git #486

Open asimon-1 opened 4 years ago

asimon-1 commented 4 years ago

Steps to reproduce the issue:

Thoughts for the cause of the issue

The VCS class for git utilizes the .gitignore file to determine which files to ignore. The BaseWorkingCopy superclass strips leading and trailing slashes and uses relative paths for all patterns, which can cause differences in interpretation between Doorstop's file discovery and git's. The gitignore documentation is available here: https://git-scm.com/docs/gitignore

asimon-1 commented 4 years ago

Note that this particular example is also entangled with the if branch that excludes the common hidden filename convention.

    def paths(self):
        """Yield non-ignored paths in the working copy."""
   ...
                    # Skip hidden paths
                    if os.path.sep + '.' in os.path.sep + relpath:
                        continue
    ...
asimon-1 commented 4 years ago

It may be the case that Doorstop matches the "." portion of this rule matches to the project root instead of the period character.