steveukx/git-js

git.log locks when using stat or numstat

chriseaton opened this issue · 3 comments

Using git version 2.39.3.

On a repo if I run git log --numstat I recieve logs with stats OK, however with simplegit, if I call await git.log({'--numstat': null}) the code will lock.

From what I can tell, it's getting all the way to run the task, and tries to execute the task:

{"commands":["log","--pretty=format:òòòòòò %H ò %h ò %P ò %p ò %aI ò %s ò %D ò %b ò %an ò %ae òò","--all","--since=2024-02-04"],"format":"utf-8"}

which seems to hiccup and lock here likely due to parsing failure somewhere that goes uncaught by the promise for some reason (perhaps due to stdout still being open or something, dunno).

Hi, from the official git documentation https://git-scm.com/docs/git-log#Documentation/git-log.txt--Lltfuncnamegtltfilegt the git diff formats aren't implemented for git log, which is why they've not been catered for here.

To use --numstat please switch to git.diffSummary - an example is in the unit tests https://github.com/steveukx/git-js/blob/main/simple-git/test/unit/diff.spec.ts#L243.

I will add some tests to simple-git soon to reject known invalid arguments rather than letting the process hang.

Based on the extra commands in your snippet, I've created an integration test to cover the use of your custom format block along with the --all, --since and --numstat options in https://github.com/steveukx/git-js/blob/main/simple-git/test/integration/log-numstat.spec.ts

I'm unable to reproduce a hang situation. Please create a failing integration test for me to look into this further. Thanks

This issue has been automatically closed due to a lack of response. If your problem persists please open a new issue including any additional detail requested from this issue. For more detail on the issues/pull requests see ISSUES_AND_PULL_REQUESTS