Skip to content
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-package failed but git apply succeed #22

Closed
leethree opened this issue Sep 30, 2017 · 6 comments
Closed

patch-package failed but git apply succeed #22

leethree opened this issue Sep 30, 2017 · 6 comments

Comments

@leethree
Copy link

leethree commented Sep 30, 2017

We are using patch-package for developing our app and it works great in development environments. But it shows a strange error when we deployed it to CircleCI.

$ "/home/circleci/project/node_modules/.bin/patch-package"
patch-package: Applying patches...

**ERROR** Failed to apply patch for package react-native-device-info

  This error was caused because Git cannot apply the following patch file:

    patches/react-native-device-info+0.11.0.patch

  This is usually caused by inconsistent whitespace in the patch file.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1

But the patches seem to be working fine when I use git apply

$ git apply patches/*

(Succeeded, no output message)

The environment for CircleCI is:

  • Docker container: circleci/node:8
  • Node v8.6.0
  • Yarn v1.1.0
  • patch-package v3.4.2
@ds300
Copy link
Owner

ds300 commented Sep 30, 2017

Thanks for the report, I'm looking into it!

@ds300
Copy link
Owner

ds300 commented Sep 30, 2017

I managed to reproduce the issue. It's caused because the --unsafe-paths option we use for git apply is not supported with the version of git provided on that docker image. It has 2.1.4, but --unsafe-paths first appeared around 2.3 (from January 2015). Is it possible for you to use a docker image with a newer version of Git?

@ds300
Copy link
Owner

ds300 commented Sep 30, 2017

I'm going to fix this anyway. IIRC --unsafe-paths is only useful for situations where the project is not under source control with git, so I'll just avoid using it unless that's the case.

@ds300
Copy link
Owner

ds300 commented Sep 30, 2017

Hmm, so --unsafe-paths is actually only useful for situations where the files to be patched are outside of the current working directory, which I think should never happen with patch-package. I'll try just removing it altogether.

@ds300
Copy link
Owner

ds300 commented Sep 30, 2017

This should be fixed now in patch-package@3.4.4 - feel free to reopen the issue if you find otherwise.

@ds300 ds300 closed this as completed Sep 30, 2017
@leethree
Copy link
Author

I confirm the issue is fixed with patch-package@3.4.4. It now works great on the CircleCI image. Thank you a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants