We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If a patch is supposed to completely erase a file, applyPatch will instead keep the first line.
applyPatch
$ cat testfile This is a file, yo $ cat > testfile # empty the file out $ cat testfile $ git diff > diff.patch # create unified patch w/ git $ cat diff.patch diff --git a/testfile b/testfile index c9d61c6..e69de29 100644 --- a/testfile +++ b/testfile @@ -1,5 +0,0 @@ -This -is -a -file, -yo $ git checkout -- . # restore testfile $ cat testfile This is a file, yo $ patch -p1 < diff.patch # test with 'patch' patching file testfile $ cat testfile # yep, worked $ git checkout -- . # restore testfile again $ cat patch.js var fs = require('fs'); var diff = require('diff'); console.log( diff.applyPatch( fs.readFileSync('testfile', 'utf8'), fs.readFileSync('diff.patch', 'utf8') ) ); $ node patch.js # this should be empty This
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
If a patch is supposed to completely erase a file,
applyPatch
will instead keep the first line.The text was updated successfully, but these errors were encountered: