Open calaoa opened 4 years ago
Is anyone experiencing the same issue or is it more me misusing the API? The lib is awesome by the way, thumbs up.
Hi & thank you for the 👍, there isn't a parser built into the library that supports the patch (-p
) response format, which is why the response appears empty...
If you have a parser available to you (perhaps something like diff2html would help) then you can get the raw response from git using await git.raw(['log', '-p'])
.
If you need the summary detail without the full patch detail, remove the -p
option and the response should contain all the expected detail - you can choose which details are included by setting the formats option object to have any of the supported pretty format constants.
Thanks a lot for the guidance. I had overlooked the raw
function, cool, even though a real integration into the library would be a handy enhancement indeed.
My use case is the following: collaborative notes are versioned via git and the users want to browse the recent changes in a row without the need to click on each individual commit to view the actual updates, hence the need for the -p
switch, I guess.
I started looking into SimpleGit.log
code, I'll see if I can come up with a patch proposal (not sure, will try).
Just a quick note to ask whether the pull request I submitted for this issue makes any sense indeed and if there's a chance it can be merged (no hurry, just asking) /cheers + thumbs up
On second thoughts, it's probably not a good idea to have added a dependency to diff2html in #444 since developers might prefer other parsing libraries. Meantime I proceeded as you suggested @steveukx : I invoked the raw
function, for now with a copy of the ListLogSummary
parser, completed by a diff2html call, thanks for your guidance. Exporting the ListLogSummary
parser might be useful so that it can be used by customized parsers, what do you think (or adding a hook to it for injecting patch parsing)? Closing #444.
Steps to reproduce
log
function with options{"-p": null}
Actual result
The returned data contains a DiffSummary object but it seems to be empty while the log obtained via the git command line is not (see detailed output example below for a given commit).
Environment
Example
ListLogLine obtained via simple-git
Log line obtained via git for the same commit