1

im trying to check lines of code using diff in the git repository with last commit and HEAD, but there's an error showing up,

$ cloc -- diff 182712379cae1b953c5976854e735134530e8241 HEAD

Error:

0 text files.

0 text files.

0 files ignored.

2 errors: Unable to read: 182712379cae1b953c5976854e735134530e8241

Unable to read: HEAD

Nothing to count.

Sadzone
  • 73
  • 2
  • 13

2 Answers2

5

Both --git and --diff:

cloc --git --diff 18271237 HEAD

AlDanial
  • 419
  • 2
  • 4
  • 1
    Please edit your existing answer instead of adding a new one. – Hasturkun Oct 03 '18 at 13:42
  • im still getting the same error `unknown option: git`, im trying to get fist commit hash and `HEAD` difference in the repository, using the following, `git rev-list --max-parents=0 HEAD` then `182712379cae1b953c5976854e735134530e8241` – Sadzone Oct 04 '18 at 02:37
  • 2
    Which version of cloc (``cloc --version``)? The ``--git`` option has been available for at lest a year. – AlDanial Oct 04 '18 at 14:08
  • 2
    @Sadzone: you'll need to get a newer version of cloc (from https://github.com/AlDanial/cloc/releases). v1.78 has a git related bug so maybe try 1.76. I plan to release 1.80 tomorrow if I have enough time. – AlDanial Oct 05 '18 at 03:41
  • 1
    @AlDanial I have updated the version of cloc 1.78, and it did work well, looking forward to seeing your newer version of cloc. thank you. really appreciate your help. – Sadzone Oct 05 '18 at 04:15
  • Just released 1.80. If you encounter any problems with it please post an issue on the cloc github page. – AlDanial Oct 05 '18 at 23:04
0

You'll need to add the --git switch otherwise cloc will think HEAD is the name of a file or directory.

AlDanial
  • 419
  • 2
  • 4
  • should I insert cloc --git instead of cloc --diff ??? if i entered cloc --git i do get an error unknown option: git – Sadzone Oct 02 '18 at 06:01