git check-ignore */**不列出文件夹 [英] git check-ignore */** not listing folders
问题描述
此问题已更改,因为错误描述有误!感谢@Tim和@Jubobs
.gitignore文件中有整个文件夹,但是当我使用时
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?
示例文件夹结构:
回购:
repo/.git
repo/.gitignore
repo/hello/__world/test.txt
在.gitignore中:
In .gitignore:
**/__world/**
当我现在在根目录中调用git check-ignore */**
时,什么都不会显示,当我cd
进入hello
目录时,hello/__folder/text.txt
出现!
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!
当我打电话
git check-ignore */**/**
我实际上可以看到该文件.
I can actually see the file.
是否对此有无限"递归? (这样,即使在更深的文件夹中我也可以找到文件)
推荐答案
当我现在在根目录中调用
git check-ignore */**
时,什么都不会显示,当我cd
进入hello
目录时,hello/__folder/text.txt
出现!
When I now call
git check-ignore */**
in the root directory nothing will show up, when Icd
into thehello
directory,hello/__folder/text.txt
shows up!
请注意,在Git 2.17之前(2018年第二季度,是两年半之后),当一个是文件而另一个是目录时,具有多个路径的"git check-ignore
"变得很困惑.
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.
请参见提交d60771e (2018年2月10日) ://github.com/rscharfe"rel =" nofollow noreferrer>RenéScharfe(rscharfe
).
(由 Junio C Hamano-gitster
-在
See commit d60771e (10 Feb 2018) by René Scharfe (rscharfe
).
(Merged by Junio C Hamano -- gitster
-- in commit 796a788, 27 Feb 2018).
check-ignore
:修复目录和其他文件类型的混合在
check_ignore()
中,第一个pathspec项确定以下项的dtype
随后的.
这意味着与常规文件匹配的pathspec可以防止在匹配目录后跟随pathspec,这没有任何意义.
check-ignore
: fix mix of directories and other file typesIn
check_ignore()
, the first pathspec item determines thedtype
for any subsequent ones.
That means that a pathspec matching a regular file can prevent following pathspecs from matching directories, which makes no sense.
通过分别确定每个pathspec的dtype来解决此问题,
每次将值DT_UNKNOWN
传递给last_exclude_matching()
.
Fix that by determining the dtype for each pathspec separately,
by passing the value DT_UNKNOWN
to last_exclude_matching()
each time.
因此,您必须再次检查Git 2.17是否仍然存在该问题.
So you will have to check again if the issue persists with Git 2.17.
这篇关于git check-ignore */**不列出文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!