问题
This question was changed, since the error description was wrong! Thanks to help from @Tim and @Jubobs
I have entire folders in my .gitignore file, but when I use
git check-ignore */**
When they are deeper in the folder structure, they are not showing up. Is there a way around this?
example folder structure:
repo:
repo/.git
repo/.gitignore
repo/hello/__world/test.txt
In .gitignore:
**/__world/**
When I now call git check-ignore */** in the root directory nothing will show up, when I cd into the hello directory, hello/__folder/text.txt shows up!
When I call
git check-ignore */**/**
I can actually see the file.
Is there an 'infinite' recursion for this? (So I can find files even in deeper folders)
回答1:
When I now call
git check-ignore */**in the root directory nothing will show up, when Icdinto thehellodirectory,hello/__folder/text.txtshows up!
Note that before Git 2.17 (Q2 2018, two and a half years later), "git check-ignore" with multiple paths got confused when one is a file and the other is a directory, which has been fixed.
See commit d60771e (10 Feb 2018) by René Scharfe (rscharfe).
(Merged by Junio C Hamano -- gitster -- in commit 796a788, 27 Feb 2018).
check-ignore: fix mix of directories and other file typesIn
check_ignore(), the first pathspec item determines thedtypefor any subsequent ones.
That means that a pathspec matching a regular file can prevent following pathspecs from matching directories, which makes no sense.Fix that by determining the dtype for each pathspec separately, by passing the value
DT_UNKNOWNtolast_exclude_matching()each time.
So you will have to check again if the issue persists with Git 2.17.
来源:https://stackoverflow.com/questions/32351898/git-check-ignore-not-listing-folders