-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Trying to use .diffSummary with binary file differences #243
Comments
I could be wrong but it seems like the And actually, upon closer inspection of the result
In fact, it does not look like a |
The top level stats aren't rolled up from the individual file details in the response, they're parsed from the summary detail. That output is an instance of the const repo = `path/to/repo`;
const git = require('simple-git');
git(repo). diffSummary((err, summary) => { console.log(summary) }); or with promises: const repo = `path/to/repo`;
const gitP = require('simple-git/promise');
gitP(repo).diffSummary().then((summary) => { console.log(summary) }); |
@steveukx Ah, I see. I will give that a try. Thanks! |
@steveukx That did the trick. I may have a follow up to that concerning the binary nature of the file(s) under difference comparison. It "should" work as long as it is just a pass through from the |
Let me know if you have problems running against binary files - the parser used for |
Sure thing. So far so good; no insertions/deletions for the "same" package. But this is a false positive. When there are changes, or I expect there to be changes, Beyond Compare tells me there should be changes, but these are not reported via |
Static code analysis wouldn't show the calculation of If you're seeing inconsistencies with the diff summary, please run |
@steveukx Reviewing the code, I see Running diff in this manner is insufficient for binary files.
It would be better IMO to run with
|
The trailing summary line is parsed in the block https://github.com/steveukx/git-js/blob/master/src/responses/DiffSummary.js#L33-L41 with the The DiffSummary parser doesn't roll up the individual file summary values to ensure there is no error in the overall detail being reported. |
@steveukx Let's assume for a moment that a summary line is being parsed. I'm not sure that it is, but let's assume that it is. Where does it land in the resulting summary? Ah, I think I see it. It may try to find "insertions" or "deletions", but I'm not sure whether it does. Considering the summary line is:
I assure you the files are "hexadecimal" different, according to Beyond Compare. Whereas "line based" insertions or deletions are not necessarily detected in this way. |
@steveukx Thanks for pursuing this issue. Any ideas as to a publish time frame? |
I have a binary file that I am trying to track using the
.diffSummary
. I'm not sure what is being returned to be honest, because when I try toJSON.stringify(d)
, I get backTypeError: Converting circular structure to JSON
.Regardless whether binary of textual, I expect something like
{ files: [], insertions: 0, deletions: 0 }
back when there are no differences, correct?Thanks!
The text was updated successfully, but these errors were encountered: