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

.gitattributes filters with foldernames do not work outside main folder #37

Open
calebrottman opened this issue Sep 25, 2017 · 0 comments

Comments

@calebrottman
Copy link

git supports .gitattributes filters with folder names and wildcards (i.e. subpath/**/*.raw filter=bigstore. However, if you are not in the main path and do a git bigstore push, it will silently fail.

This is because in the current version, a fnmatch is called with the base filename and wildcard here.
If you are in the folder subpath that contains the file foo.raw, fnmatch will fail because it is comparing subpath/**/*.raw to foo.raw.

This issue should be fixed by replacing the line:

-            if fnmatch.fnmatch(filename, wildcard):
+            full_filename = os.path.join(os.getcwd(), filename)
+            rel_filename = os.path.relpath(full_filename, toplevel_dir)
+            if fnmatch.fnmatch(rel_filename, wildcard):

(I figured this change was too small to do a separate pull request).

@dlo dlo added the help wanted label Feb 1, 2018
@dlo dlo added this to the Next Release milestone Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants