Skip to content

cloc --git --diff fails to identify "same" files and code from v2.04 on #946

@dennisbrendel

Description

@dennisbrendel

Describe the bug
cloc v2.04 broke the --git--diff accounting of the "same" lines of code. This was noticed in v2.06 but it is already present in v2.04.

cloc; OS; OS version

  • cloc version: v2.04
  • If running the cloc source, Perl version: v5.42.0
  • OS (eg Linux, Windows, macOS, etc): Fedora
  • OS version: 43

To Reproduce

mkdir cloc_reproducer
cd cloc_reproducer
git init
echo "int main(void) {}" > file.c
git add .
git commit -am "initial commit"
git tag 1.0
echo "file.c" > list.txt
git add list.txt
git commit -m "Add list file"
git tag 2.0

Now run cloc

cloc --diff --git --list-file list.txt 1.0 2.0
       1 text file.
       1 text file.
       0 files ignored.                             
Nothing to count.

Expected result

cloc --diff --git --list-file list.txt 1.0 2.0
       1 text file.
       1 text file.
       0 files ignored.                             

github.com/AlDanial/cloc v 2.02  T=0.06 s (16.6 files/s, 16.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C
 same                            1              0              0              1
 modified                        0              0              0              0
 added                           0              0              0              0
 removed                         0              0              0              0
-------------------------------------------------------------------------------
SUM:
 same                            1              0              0              1
 modified                        0              0              0              0
 added                           0              0              0              0
 removed                         0              0              0              0
-------------------------------------------------------------------------------

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions