-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloc --git-diff-rel does not respond consistently when dealing with copy/rename #780
Comments
This problem will be difficult (impossible?) to resolve without a way for me to reproduce it. For now I will close this issue but please reopen it if you find a public repo that can demonstrate the inconsistent output. In the long term, I have a goal to implement in cloc the swith |
I think I have found a way to reproduce the problem I have described in the issue. What I get on my machine (running Ubuntu 22.04.2) is either a list of 11 differences or (less often) a list of 16 differences. I have written this nodejs script to run the commands few times - the scripts exits when it finds that the result of the previous run of the command is different from the result of the last run of the command
Attached below you may find both the results I get, the one that returns 11 records and the one that returns 16 records. |
Describe the bug
The command
cloc --git-diff-rel --csv --by-file commit-sha^1 commit-sha
does not always return the same number of records, i.e. the same number of differences.In particular, differences which are marked as copy/rename by the
git diff --numstat
, sometimes are skipped bycloc --git-diff-rel
and sometimes are listed as 2 differences.cloc; OS; OS version
To Reproduce
I have tried to reproduce the issue on some public repos but I have not been able to reproduce it
Expected result
Every run of
cloc --git-diff-rel --csv --by-file commit-sha^1 commit-sha
should return the same amount of records.Additional context
Let's say that
git diff --numstat
returns something like1 1 src/{old-subdir=> new-subdir}/my-file.java
stating that
my-file.java
has been moved fromold-subdir
tonew-subdir
adding and removing one line of code.what I get if I run the same comparison with
cloc --git-diff-rel --csv --by-file
what I get is any of these responses:src/new-subdir/my-file.java
has one line removes and one line changed, no mention to the filesrc/old-subdir/my-file.java
src/new-subdir/my-file.java
has 100 lines added andsrc/old-subdir/my-file.java
has 100 lines removes (assuming that the files contains 100 lines)which one of the 2 answers I get is random.
The text was updated successfully, but these errors were encountered: