From 1116a590195a4b90e1c67a5c5c95974164467298 Mon Sep 17 00:00:00 2001 From: Nicolas Cuillery Date: Fri, 10 Feb 2017 07:16:09 -0800 Subject: [PATCH] Allow binary files to be upgraded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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, the upgrader would also be ready for the assets optimization: #10408 by GantMan - Publish `react-native-git-upgrade` to sinopia - `npm install -g react-native-git-upgrade` - Init a new project with an old version: `react-native init MyApp --version=0.40.0` - Replace an Android icon (i.e. `MyApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png`) by any other image file. - Change the content of a text file. - Run `react-native-git-upgrade` 👉 The project is upgraded successfully. 👉 The replaced image file is still here. 👉 The text change is still here. - Replace an Android icon in the RN sources (i.e. https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/android/app/src/mai Closes https://github.com/facebook/react-native/pull/12201 Differential Revision: D4543190 Pulled By: mkonicek fbshipit-source-id: f1df32ee064557220deed717a129c3e175a6e9e2 --- react-native-git-upgrade/cliEntry.js | 2 +- react-native-git-upgrade/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react-native-git-upgrade/cliEntry.js b/react-native-git-upgrade/cliEntry.js index 2c869d485..a42b3a93d 100644 --- a/react-native-git-upgrade/cliEntry.js +++ b/react-native-git-upgrade/cliEntry.js @@ -317,7 +317,7 @@ async function run(requestedVersion, cliArgs) { await exec('git commit -m "New version" --allow-empty', verbose); log.info('Generate the patch between the 2 versions'); - const diffOutput = await exec('git diff HEAD~1 HEAD --no-color', verbose); + const diffOutput = await exec('git diff --binary --no-color HEAD~1 HEAD', verbose); log.info('Save the patch in temp directory'); const patchPath = path.resolve(tmpDir, `upgrade_${currentVersion}_${newVersion}.patch`); diff --git a/react-native-git-upgrade/package.json b/react-native-git-upgrade/package.json index dd79e8a00..1b1130207 100644 --- a/react-native-git-upgrade/package.json +++ b/react-native-git-upgrade/package.json @@ -1,6 +1,6 @@ { "name": "react-native-git-upgrade", - "version": "0.2.4", + "version": "0.2.6", "license": "BSD-3-Clause", "description": "The React Native upgrade tool", "main": "cli.js",