Skip to content

react-native-git-upgrade changes nothing #12112

@joIivier

Description

@joIivier

Description

I am trying to upgrade from react native 35 to 40. Running 'react-native-git-upgrade' in my project tells me the upgrade has been done but nothing has changed in my repository.

Output:

/usr/local/Cellar/node/7.4.0/bin/react-native-git-upgrade 
git-upgrade info Check for updates
git-upgrade info Using yarn 0.19.1
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.40.0, 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
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
warning: CRLF will be replaced by LF in android/gradlew.bat.


The file will have its original line endings in your working directory.
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: .flowconfig:1
Falling back to three-way merge...
Applied patch to '.flowconfig' with conflicts.
error: patch failed: .gitignore:22
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: android/app/src/main/java/com/appname/MainApplication.java: does not exist in index
error: cannot apply binary patch to 'android/gradle/wrapper/gradle-wrapper.jar' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/gradle/wrapper/gradle-wrapper.jar' without full index line
error: android/gradle/wrapper/gradle-wrapper.jar: patch does not apply
error: patch failed: ios/appname.xcodeproj/project.pbxproj:22
Falling back to three-way merge...
Applied patch to 'ios/appname.xcodeproj/project.pbxproj' with conflicts.
error: patch failed: ios/appname.xcodeproj/xcshareddata/xcschemes/appname.xcscheme:3
Falling back to three-way merge...
Applied patch to 'ios/appname.xcodeproj/xcshareddata/xcschemes/appname.xcscheme' cleanly.
error: ios/appname/AppDelegate.m: does not exist in index
error: patch failed: ios/appname/Info.plist:45
Falling back to three-way merge...
Applied patch to 'ios/appname/Info.plist' with conflicts.
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

Then I look in my status

git status
On branch migration-rn40-2
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	../../../old-logs

nothing added to commit but untracked files present (use "git add" to track)

Nothing. No conflict.
This is the ouptut after I ignored *.png in my global gitignore file (as per issue #11402). I had previously also warning related to the png files (although I never changed this part of the project since I'm only doing iOs for now).
After this script is run I get react native 40 in my node modules, but I couldn't build the project on Xcode which was complaining about the React native libraries of my project.

Solution

I guess the critical lines in the logs are the "without full index line" errors for the binaries I don't have (maybe because I never ran the android project) and the "does not exist in index" that is thrown for AppDelegate.m (I use swift instead).

I managed to get it to work by changing in cliEntry.js git apply --3way ${patchPath} by git apply --reject ${patchPath} which worked (I could start correctly my application afterwards) but I will have to merge manually the conflicts now.

I guess you should at least test the output code of git apply to detect a failure and print a valid error message, and maybe suggest to retry with --reset instead of --3way if the --3way failed.

Additional Information

  • React Native version: 35
  • Platform: iOs
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: FixedA PR that fixes this issue has been merged.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions