-
-
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 correctly count #799
Comments
I'll need the two versions of these files to reproduce the problem. Can you post them? |
The above screenshot is the commit provided by Gitlab, and I can provide you with these two source files: 1、SsoController package com.test.svc.web.controller; import com.test.svc.common.constant.ServiceExceptionCode; @RestController
// AuthContext authContext = (AuthContext) request.getServletContext().getAttribute(AuthConstant.AUTH_CONTEXT_KEY); } 2、SysInfoController
import com.test.svc.common.constant.ServiceExceptionCode; /**
} |
I am not sure if the “git diff” is a usage issue or if the function is incomplete. If there are any usage issues, please tell me the correct method |
I don't think the content you posted is consistent with the results you showed. I have attached the files as you provided them. These two files have little in common. When I run ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Java same 0 0 0 8 modified 1 0 1 19 added 0 4 11 10 removed 0 0 0 6 ------------------------------------------------------------------------------- SUM: same 0 0 0 8 modified 1 0 1 19 added 0 4 11 10 removed 0 0 0 6 ------------------------------------------------------------------------------- If you attach the files rather than cut/paste their contents it will be easier to work with them. |
sorry,What I am comparing is not these two files, but the two commit attempts of Gitlab。The command I executed is as follows: "39a54ce3" or "66ec3dfe" is gitlab's commit id |
Based on your screenshot, your commits refer to two files each. When you tell cloc to diff the two commits you are really saying "compare the files between these two commits". To reproduce this problem I'll either need to clone your git repo or to get the four files themselves. |
Sorry, the real files are confidential. I'm wondering if you support the "git diff" feature. I want to use this feature to count the changes made in a git commit, such as additions, modifications, and deletions. |
cloc uses internal logic to compute diffs between two commits (the output from However, without the input files, I won't be able to tell why the results are not as you expect. If you encounter this problem with files you are able to distribute, please open a new issue. |
Describe the bug
cloc counts respond incorrectly count when counting diffs between 2 commits
cloc; OS; OS version
To Reproduce
cloc-1.98 --diff 39a54ce3 66ec3dfe
the result
![image](https://private-user-images.githubusercontent.com/19197938/293845531-75c805b4-6634-4e11-9088-c84c110a5428.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk0MjMyNjYsIm5iZiI6MTcxOTQyMjk2NiwicGF0aCI6Ii8xOTE5NzkzOC8yOTM4NDU1MzEtNzVjODA1YjQtNjYzNC00ZTExLTkwODgtYzg0YzExMGE1NDI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI2VDE3MjkyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU3MjU2YjVjNTY3ODUyOGJlNjdkY2I0YjBhZDJiYmJhZWI0YTJhNjFmN2E1MmZmMzQ3ZjVhYzc4MGRlM2Q1MTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.w8XMbNwulCRjEv57CrJx2cX1-zT0D6mGvmZxiyRYYFM)
refer to the commit different of gitlab
Expected result
I expect the modified code to be 7, the added code to be 1 or 0,the removed code to be 1.
The text was updated successfully, but these errors were encountered: