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

Relative recursive patterns should be rewritten using ** #302

Closed
aomarks opened this issue Nov 5, 2020 · 1 comment · Fixed by #308
Closed

Relative recursive patterns should be rewritten using ** #302

aomarks opened this issue Nov 5, 2020 · 1 comment · Fixed by #308
Labels

Comments

@aomarks
Copy link

aomarks commented Nov 5, 2020

Per https://git-scm.com/docs/gitignore#_pattern_format, if you have a .gitignore pattern that does not contain a slash at the start or in the middle, then it matches recursively in any sub-directory relative the .gitignore dirname:

Examples:

  • foo.js matches ./foo.js and ./bar/foo.js
  • foo/ matches ./foo/ and ./bar/foo/
  • /foo.js only matches ./foo.js
  • foo/bar.js only matches ./foo/bar.js

However, currently when using the [relative] tag, globs are rewritten simply by prepending the dirname of the .gitignore, e.g.:

  • foo.js becomes relative/path/foo.js

This is incorrect, because it converts recursive patterns into non-recursive ones. I think patterns without a slash at the start or middle should instead be re-written using a **:

  • foo.js becomes relative/path/**/foo.js
  • foo/ becomes relative/path/**/foo/
  • /foo.js becomes relative/path/foo.js
  • foo/bar.js becomes relative/path/foo/bar.js
@foray1010
Copy link
Owner

fixed in 3.0.1🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants