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

Git VCS class parses gitignore files differently from git #486

Open
asimon-1 opened this issue Sep 9, 2020 · 2 comments
Open

Git VCS class parses gitignore files differently from git #486

asimon-1 opened this issue Sep 9, 2020 · 2 comments
Projects
Milestone

Comments

@asimon-1
Copy link
Contributor

asimon-1 commented Sep 9, 2020

Steps to reproduce the issue:

  • Initialize a Doorstop project with git as the version control provider
  • Create the file testfile1.txt in the project root
  • Create the file testfile2.txt in a .dir directory within the project root
  • Add an item with the ref field pointing to testfile1.txt
  • Add an item with the ref field pointing to testfile2.txt
  • Put the following lines in the .gitignore file to ignore all files within any directory that begins with a period
.*/
!.gitignore
  • Git should ignore testfile2.txt but not testfile1.txt
  • Run the Doorstop validation routine, and observe that the external reference finder for both items fails, when only testfile2.txt is in an ignored directory

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
Copy link
Contributor Author

asimon-1 commented Sep 9, 2020

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
Copy link
Contributor Author

asimon-1 commented Sep 9, 2020

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

@neerdoc neerdoc added this to Inbox in Work via automation Mar 9, 2022
@neerdoc neerdoc moved this from Inbox to To do in Work Mar 9, 2022
@neerdoc neerdoc added this to the v2.3 milestone Mar 9, 2022
@jacebrowning jacebrowning modified the milestones: v3.0, v3.1 Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Work
To do
Development

No branches or pull requests

3 participants