react-native: react-native-git-upgrade fails when using custom android icons?
Good day React Native team, keep up the amazing work!
Description
I’m attempting to upgrade from RN v0.35
to v0.39.1
. I first tried upgrading with the traditional react-native upgrade
but that method no longer gives you the ability to see a diff for the changed files (which was a really useful feature IMO).
So I opted for the new react-native-git-upgrade
, which seems to work. However, after the upgrade is done, there are no physical changes to any of the files in my project.
I keep seeing these errors in the output, which seem awfully different from the rest of the errors:
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
Here’s the full output of the upgrade, followed by a git status
showing no changes made to the project.
$ react-native-git-upgrade
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.39.1, React ~15.4.0-rc.4
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
error: patch failed: .gitignore:22
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: patch failed: android/app/src/main/java/com/beepyonative/MainApplication.java:8
Falling back to three-way merge...
Applied patch to 'android/app/src/main/java/com/beepyonative/MainApplication.java' with conflicts.
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-hdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-mdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-mdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-mdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xhdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xhdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: patch does not apply
error: patch failed: ios/BeepyoNative.xcodeproj/project.pbxproj:22
Falling back to three-way merge...
Applied patch to 'ios/BeepyoNative.xcodeproj/project.pbxproj' with conflicts.
error: patch failed: ios/BeepyoNative/Info.plist:45
Falling back to three-way merge...
Applied patch to 'ios/BeepyoNative/Info.plist' cleanly.
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Reproduction
Assuming my hunch about the android icons is correct…
- Add custom ic_loader.png files in a non-current React Native project
cd path/to/project
react-native-git-upgrade
- The upgrade does not actually get applied
Solution
- More clarity as to why the upgrade did not get applied.
- Possibly a bug fix if app icon conflicts really are hosing the upgrade.
Additional Information
- React Native version: 0.35
- Platform: iOS, Android
- Operating System: macOS
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 11
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Allow binary files to be upgraded Summary: `react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402 With this PR, ... — committed to facebook/react-native by ncuillery 7 years ago
- Allow binary files to be upgraded Summary: `react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402 With this PR, ... — committed to GaborWnuk/react-native by ncuillery 7 years ago
- Allow binary files to be upgraded Summary: `react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402 With this PR, ... — committed to dudeinthemirror/react-native by ncuillery 7 years ago
- Allow binary files to be upgraded Summary: `react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402 With this PR, ... — committed to dudeinthemirror/react-native by ncuillery 7 years ago
- Allow binary files to be upgraded Summary: `react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402 With this PR, ... — committed to fullcontact/react-native by ncuillery 7 years ago
Adding the
exclude
option fixes the issue related to custom icons but in my case I still see an error related toproject.pbxproj
.Do you guys have any idea on how to fix this ? Thanks.
Thanks for the detailed report 🤓
We want the
git apply
command run byreact-native-git-upgrade
under the hood to ignore these files. I think theexclude
option of the apply should do the trick.In the meantime, here is a dirty workaround:
Git provides 3 different “ignore” files:
.gitignore
.git/info/exclude
$HOME/.gitignore
We can’t rely on the first one because it is overrided by the upgrading process. We can’t rely on the second as well because we create a temporary repository on-the-fly. Let’s use the third:
Hello!
After I run the command, my dependencies are upgraded inside
node_modules
but mypackage.json
is not updated, is that normal? Also the build doesn’t work anymore, after running the upgrade command myproject.pbxproj
from xcode project gets deleted. Reverting it with git brings back the file, but the build is still not working.This is the log after the
react-native-git-upgrade
:The build error that I get:
Anybody has a clue of what’s going on? I am trying to upgrade from RN@0.36.1 to latest on a MacOS machine.
I needed to run
git config --global core.excludesfile '~/.gitignore
in order to use the workaround@hramos, this issue should absolutely stay open. There are a lot of people reporting this issue, and no one to pick up the problem. This is a really pressing problem as it removes a lot of the kind of code that takes a while to figure out, so we are all stuck rebuilding our projects from square one. react-native-git-upgrade should absolutely not be used until this can be fixed.
I upgrade my project from RN0.32.1 to RN 0.44.0, I can’t open my project, and I lost some files.
I lost my files under the project folder