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

Time:05-03

If the beginning of my cloc --vcs git output is something like the following:

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

Question 1: Is there a way to get a list of all the files ignored by the cloc command?

Also, if I instead run cloc "repo_name", it shows a completely different number of files.

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

Question 2: How can I get a list of which files are being skipped when running the --vcs command?

CodePudding user response:

#1, Ref. the --ignored switch in the documentation (either at https://github.com/AlDanial/cloc or via cloc --help):

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

#2, --vcs git uses git ls-files to get the list of files to count. Without this, cloc does a recursive search in the given directory. If only a subset of files in "repo_name" are under git control, or if you have entries in .gitignore, the two methods of getting file names will differ. This is also explained in the documentation.

git ls-files --other

will show files that aren't under git control.

  • Related