Git Product home page Git Product logo

Comments (13)

ds300 avatar ds300 commented on May 22, 2024 1

Published in 3.6.0 🎉

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

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:

git apply --verbose --ignore-whitespace --whitespace=nowarn patches/jison-lex+0.3.4.patch

Is it any different if you use this:

git apply --verbose --unsafe-paths --ignore-whitespace --whitespace=nowarn patches/jison-lex+0.3.4.patch

?

from patch-package.

roman-spiridonov avatar roman-spiridonov commented on May 22, 2024

Windows 10. I am using Cygwin, but same is reproduced under windows cmd.
However, I believe my git is from Cygwin installation (apt-cyg install git).

$ 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.

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

Hmm that version of git is a couple of years old. Could be the issue. The one cygwin installed for me is 2.14 and it works fine:

image

from patch-package.

roman-spiridonov avatar roman-spiridonov commented on May 22, 2024

Well I went through all the pain of updating my cygwin 😃 (after updating git through apt-cyg it did not work because it required me to update whole cygwin) Unfortunately, the problem did not disappear. I will check tomorrow on another Win10 machine at my office.

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'.

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

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 [Stanford] Compilers folder to something that doesn't contain any 'special' characters, then regenerating the patch file. It might be the cause of the issue on your machine.

Sorry about the trouble, and thanks again for the report!

from patch-package.

roman-spiridonov avatar roman-spiridonov commented on May 22, 2024

wouldn't work anyway because of the fact that your npm project is not at the git root

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 .git folder from parent, it works fine.

This behavior is fine as far as I am concerned, certainly a minor thing if you know it. I can work around that. Thanks!

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

@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: npm i --save-dev patch-package@beta

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

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!

from patch-package.

roman-spiridonov avatar roman-spiridonov commented on May 22, 2024

Unfortunately still getting the same behavior.
I am not able to apply patch because .git folder (git root) is in upper directory.
If I remove the .git folder, it works just fine.

Also, notice that additional information about .gitattributes has disappeared in the new release (maybe this is fine, just noticing).

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...
[email protected]

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

Argh :(

Can you try deleting the first two lines of the patch file (beginning with diff and index) and running the git apply command again?

git apply --verbose --ignore-whitespace --whitespace=nowarn patches/jison-lex+0.3.4.patch

I removed the .gitattributes warning because whitespace inconsistencies should no longer prevent patches from being applied.

from patch-package.

roman-spiridonov avatar roman-spiridonov commented on May 22, 2024

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.

from patch-package.

ds300 avatar ds300 commented on May 22, 2024

Great! I should have a permanent fix for this later tonight.

from patch-package.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.