Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

git check-ignore outputting unignored files

The file https://github.com/tanafaso/tanafaso-frontend/blob/master/lib/net/api_interface/azkar/requests/get_categories_response.dart is not ignored by git, and that’s expected as I have only listed azkar/ in .gitignore which means that only the directory azkar/ under the root should be ignored.

However, git check-ignore thinks that the file will be ignored and that it satisfies the pattern azkar/.

➜  azkar-frontend git:(master) ✗ git check-ignore --verbose lib/net/api_interface/azkar/requests/get_categories_response.dart
.gitignore:20:azkar/    lib/net/api_interface/azkar/requests/get_categories_response.dart

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

From https://git-scm.com/docs/gitignore#_pattern_format :

If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.

Nothing is said about directory level unlike

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore…

Hence the pattern azkar/ matches any directory "azkar" deep in the directory hierarchy.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading