如何获取 cloc 忽略或跳过的文件列表

How to get a list of files ignored or skipped by cloc

如果我的 cloc --vcs git 输出的开头类似于以下内容:

    1826 text files.
    1780 unique files.                                          
     384 files ignored.

问题 1:有没有办法得到 cloc 命令忽略的所有文件的列表?

此外,如果我改为 运行 cloc "repo_name",它会显示完全不同的文件数。

    2106 text files.
    1981 unique files.                                          
     346 files ignored.

问题 2: 如何获得在 运行 执行 --vcs 命令时跳过哪些文件的列表?

#1,参考。文档中的 --ignored 开关(在 https://github.com/AlDanial/cloc 或通过 cloc --help):

--ignored=<file>      Save names of ignored files and the reason they
                       were ignored to <file>.

#2,--vcs git 使用 git ls-files 获取要计数的文件列表。如果没有这个,cloc 会在给定的目录中进行递归搜索。如果 "repo_name" 中只有一部分文件受 git 控制,或者如果您在 .gitignore 中有条目,则两种获取文件名的方法将不同。文档中也对此进行了解释。

git ls-files --other

将显示不受 git 控制的文件。