git-diff icon indicating copy to clipboard operation
git-diff copied to clipboard

NPM - Returns the git diff of two strings

Results 9 git-diff issues
Sort by recently updated
recently updated
newest added

Strings of the pattern `\$\d` seem to be getting substituted out. This is resulting in simple dollar amounts being mangled. I imagine this could be due to some step where...

Because of https://nvd.nist.gov/vuln/detail/CVE-2022-0144 Landing this is going to require a release.

When comparing two very long strings, there is an automatic fallback to the fake gitDiff algorithm. My server stops responding to requests for ~60+ seconds. Please (if you can) add...

Passing strings to diff as unescaped shell arguments to `printf` can result in unexpected (and **potentially exploitable**) behaviour if the strings contain special characters, such as backticks (`). This adds...

I have a view that I want to either highlight added OR removed lines, but not both at the same time. Is there a way to diff for ONLY added...

E.g. comparing two strings that are ~30 lines each takes ~40ms where ones that are ~3000 take 20+ seconds

As long as the sync function is really sync, i.e. no other node.js code can run while it's waiting for the data, then there's no way to make it async....

JSON.stringify [does not protect](https://gist.github.com/mk-pmb/87529a1f65fd47f0abd4d0199536c389) against shell command injection. Please use proper child_process APIs and send the data via an stdin pipe. Thanks to @sehrope for pointing out this bug on...

``` const gitDiff = require('git-diff') const oldStr = 'fred\n is \nfunny\n' const newStr = 'fred\n is \nfunny \n' const diff = gitDiff(oldStr, newStr, { flags: '--diff-algorithm=minimal --ignore-all-space' }) ``` result:...