0

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?

Akaisteph7
  • 5,034
  • 2
  • 20
  • 43

1 Answers1

1

#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.

Akaisteph7
  • 5,034
  • 2
  • 20
  • 43
AlDanial
  • 419
  • 2
  • 4
  • Thanks @AlDanial. That totally answers the first question. The second was meant to be similar (I've updated it to clarify), how can I get a list of the skipped files? – Akaisteph7 Apr 28 '22 at 13:02
  • 1
    ``git ls-files --other`` will show files that aren't under git control, is that what you mean by "skipped"? – AlDanial May 01 '22 at 17:54
  • $ /usr/bin/cloc --ignored=/tmp/ian/cloc-ignored --by-file-by-lang --vcs=git 56 text files. 56 unique files. mkdir /tmp/ian/ Wrote /tmp/ian/cloc-ignored 2 files ignored. – m4r35n357 May 16 '23 at 14:47