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

Fix core.excludesfile named .gitignore #2269

Merged
merged 1 commit into from
Apr 16, 2014
Merged

Conversation

arrbee
Copy link
Member

@arrbee arrbee commented Apr 14, 2014

Ignore rules with slashes in them are matched using FNM_PATHNAME and use the path to the .gitignore file from the root of the repository along with the path fragment (including slashes) in the ignore file itself. Unfortunately, the relative path to the .gitignore file was being applied to the global core.excludesfile if that also happened to be named ".gitignore".

This fixes that with more precise matching and includes test for ignore rules with leading slashes (which were the primary example of this being broken in the real world).

This also backports an improvement to the file context logic from the threadsafe-iterators branch (i.e. PR #2108) so we don't rely on mutating the key of the attribute file name to generate the context path. Instead, the matching rule parser just expects a trailing filename and strips it off when it parses the rule.

This is an alternate fix for Issue #2266 to PR #2267 - sorry @robrix, once I wrote the tests, it was easier just to write the fix for this as well...

Ignore rules with slashes in them are matched using FNM_PATHNAME
and use the path to the .gitignore file from the root of the
repository along with the path fragment (including slashes) in
the ignore file itself.  Unfortunately, the relative path to the
.gitignore file was being applied to the global core.excludesfile
if that was also named ".gitignore".

This fixes that with more precise matching and includes test for
ignore rules with leading slashes (which were the primary example
of this being broken in the real world).

This also backports an improvement to the file context logic from
the threadsafe-iterators branch where we don't rely on mutating
the key of the attribute file name to generate the context path.
@arrbee
Copy link
Member Author

arrbee commented Apr 15, 2014

The Travis build just failed with a timeout, not an actual error, I believe.

@vmg
Copy link
Member

vmg commented Apr 15, 2014

Rerunning...

@robrix
Copy link
Contributor

robrix commented Apr 15, 2014

❤️ you’re the best, @arrbee.

vmg pushed a commit that referenced this pull request Apr 16, 2014
Fix core.excludesfile named .gitignore
@vmg vmg merged commit 37ab5ec into development Apr 16, 2014
@vmg
Copy link
Member

vmg commented Apr 16, 2014

Green!

@arrbee arrbee deleted the rb/fix-leading-slash-ignores branch April 25, 2014 16:55
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
…ores

Fix core.excludesfile named .gitignore
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