Skip to content

Fix several ignore and attribute file behavior bugs #2279

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

Merged
merged 5 commits into from
Apr 19, 2014

Conversation

arrbee
Copy link
Member

@arrbee arrbee commented Apr 18, 2014

Fix #2276, #2277, and #2278

See the specific bugs for more detail. The high level description is that this fixes:

  • Ignores were being "popped" during directory iteration if the suffix of the directory matched the suffix of the parent directory.
  • Attribute macros might not be loaded before attribute files in subdirectories were parsed
  • Match patterns like /**/* (and trailing /* on patterns in general) were not being treated the same as core Git

arrbee added 4 commits April 18, 2014 10:32
When traversing the directory structure, the iterator pushes and
pops ignore files using a vector.  Some directories don't have
ignore files, so it uses a path comparison to decide when it is
right to actually pop the last ignore file.  This was only
comparing directory suffixes, though, so a subdirectory with the
same name as a parent could result in the parent's .gitignore
being popped off the list ignores too early.  This changes the
logic to compare the entire relative path of the ignore file.
There was a latent bug where files that use macro definitions
could be parsed before the macro definitions were loaded.  Because
of attribute file caching, preloading files that are going to be
used doesn't add a significant amount of overhead, so let's always
preload any files that could contain macros before we assemble the
actual vector of files to scan for attributes.
Ignore patterns that ended with a trailing '/*' were still needing
to match against another actual '/' character in the full path.
This is not the same behavior as core Git.

Instead, we strip a trailing '/*' off of any patterns that were
matching and just take it to imply the FNM_LEADING_DIR behavior.
@arrbee
Copy link
Member Author

arrbee commented Apr 18, 2014

Uh oh. Test failures. 😢

Only apply LEADING_DIR pattern munging to patterns in ignore and
attribute files, not to pathspecs used to select files to operate
on.  Also, allow internal macro definitions to be evaluated before
loading all external ones (important so that external ones can
make use of internal `binary` definition).
@arrbee
Copy link
Member Author

arrbee commented Apr 18, 2014

Okay, good. A couple of those behavior tweaks were getting applied a little bit too broadly. This should be better.

@vmg
Copy link
Member

vmg commented Apr 19, 2014

:))

vmg pushed a commit that referenced this pull request Apr 19, 2014
Fix several ignore and attribute file behavior bugs
@vmg vmg merged commit 7b0f8ba into development Apr 19, 2014
@robrix
Copy link
Contributor

robrix commented Apr 19, 2014

❤️

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.

3 participants