-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
Patch is not applied under windows (not a CRLF problem) #28
Comments
Thanks for the report! Unfortunately I can't reproduce the issue on windows server 2016. What's your setup? i.e. windows version, shell, git version, etc? What output you do get for this command:
Is it any different if you use this:
? |
Windows 10. I am using Cygwin, but same is reproduced under windows cmd. $ which git
/usr/bin/git
$ git --version
git version 2.7.0 The output of both commands is just empty. No changes are applied to the files as well. |
Well I went through all the pain of updating my cygwin 😃 (after updating git through The only difference is that both commands now report the following instead of empty report: $ git apply --verbose --unsafe-paths --ignore-whitespace --whitespace=nowarn patches/jison-lex+0.3.4.patch
Skipped patch 'node_modules/jison-lex/regexp-lexer.js'. |
I've done some more testing and found that it works the first time, but I get the error if I run patch-package a second time on already-patched files. Might be related, still investigating. It just occurred to me that the git commands I gave to you wouldn't work anyway because of the fact that your npm project is not at the git root. In that case, patch-package rewrites the patch file to make the file paths relative to the git root, but maybe it's possible to avoid that rewriting by generating patch files that aren't tied to a git index. I'll look in to that as well. Maybe you could try renaming the Sorry about the trouble, and thanks again for the report! |
It looks like the fact that I have a .git root in parent directory is exactly the issue (also mentioned here in the last response). If I move the directory to a different location, or even if I simply remove the This behavior is fine as far as I am concerned, certainly a minor thing if you know it. I can work around that. Thanks! |
@roman-spiridonov I released a beta version with a slightly different way to handle these kinds of situations. It would be cool if you could try it: |
I just published it under 3.5.3 - If I don't hear back from you in a few days I'll close this issue. Thanks again! |
Unfortunately still getting the same behavior. Also, notice that additional information about Here is the sequence of steps to reproduce: $ patch-package
patch-package: Applying patches...
**ERROR** Failed to apply patch for package jison-lex
This error was caused because Git cannot apply the following patch file:
patches/jison-lex+0.3.4.patch
This is usually caused by inconsistent whitespace in the patch file.
$ mv ../../.git ../../.git~
$ patch-package
patch-package: Applying patches...
jison-lex@0.3.4 ✔ |
Argh :( Can you try deleting the first two lines of the patch file (beginning with
I removed the .gitattributes warning because whitespace inconsistencies should no longer prevent patches from being applied. |
It worked! $ git apply --verbose --ignore-whitespace --whitespace=nowarn patches/jison-lex+0.3.4.patch
Checking patch [Stanford] Compilers/cool-jison/node_modules/jison-lex/regexp-lexer.js...
Applied patch [Stanford] Compilers/cool-jison/node_modules/jison-lex/regexp-lexer.js cleanly. |
Great! I should have a permanent fix for this later tonight. |
Published in 3.6.0 🎉 |
It seems that the latest patch-package has issues working under windows (I did not check the other versions). My patch file has LF endings, the file in node_modules/ also does.
Note that the patch applied successfully through
Maybe just use
patch
in your package? :)That patch that I am using is here: https://github.com/roman-spiridonov/sandbox/tree/master/%5BStanford%5D%20Compilers/cool-jison.
P.S. I do not know how to create and apply the patch through
git diff
/git apply
manually, because node_modules/ folder is in my global .gitignore. Note that patch is created just fine but I cannot apply that.The text was updated successfully, but these errors were encountered: