react-native-git-upgrade 失败,命令 'git diff --binary --no-color HEAD~1 HEAD' 退出,代码为 null



当从 react-native 0.56 运行react-native-git-upgrade到 0.57.3 时,我完成了大多数步骤,但失败了Generate the patch between the 2 versions

git-upgrade info Check for updates 
git-upgrade info Using yarn 1.9.4 
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.57.3, React 16.6.0-alpha.8af6728 
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 
warning: CRLF will be replaced by LF in node_modules/chain-function/.gitattributes.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/.npmignore.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/index.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in node_modules/chain-function/test.js.
The file will have its original line endings in your working directory.
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 
warning "react-native > metro > babel-preset-fbjs > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
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 ERR! An error occurred during upgrade: 
git-upgrade ERR! Error: Command 'git diff --binary --no-color HEAD~1 HEAD' exited with code null:
stderr: undefined

失败的特定 git 命令是比较 node_modules/' 中的两个文件

diff --git a/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/lodash/_getSymbolsIn.js b/node_modules/@babel/plugin-syntax-object-rest-spread/node_modules/lodash/_getSymbolsIn.js
deleted file mode 100644
index cec0855..0000000
--- a/node_modulesgit-upgrade ERR! An error occurred during upgrade: 
git-upgrade ERR! Error: Command 'git diff --binary --no-color HEAD~1 HEAD' exited with code null:
stderr: undefined

编辑:

.gitignore更改为忽略 Pod 后,我得到node_modules

git-upgrade info Save the patch in temp directory 
git-upgrade info Reset the 2 temporary commits 
HEAD is now at b09d589 Project snapshot
git-upgrade info Apply the patch 
error: .flowconfig: does not exist in index
error: patch failed: android/app/build.gradle:137
Falling back to three-way merge...
Applied patch to 'android/app/build.gradle' with conflicts.
error: patch failed: android/build.gradle:1
Falling back to three-way merge...
Applied patch to 'android/build.gradle' with conflicts.
error: patch failed: android/gradle/wrapper/gradle-wrapper.properties:2
Falling back to three-way merge...
Applied patch to 'android/gradle/wrapper/gradle-wrapper.properties' with conflicts.
error: patch failed: ios/Neuron.xcodeproj/project.pbxproj:13
Falling back to three-way merge...
Applied patch to 'ios/Neuron.xcodeproj/project.pbxproj' with conflicts.
error: ios/Neuron.xcodeproj/xcshareddata/xcschemes/Neuron-tvOS.xcscheme: does not exist in index
error: patch failed: ios/Neuron/Info.plist:9
Falling back to three-way merge...
Applied patch to 'ios/Neuron/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 
git-upgrade info Temporary working directory: /var/folders/dl/t15md38s6b1d9sfsnbk7my280000gn/T/react-native-git-upgrade 

我的 git 目录中没有变化,但 Temp 工作目录中有一个补丁

基于此链接,该链接表明 git 命令由于.gitignore而失败:https://github.com/facebook/react-native/issues/11402

我把我的.gitignore都消灭了,除了Podsnode_modules,它基本上有效。

当我收到诸如does not exist in indexpatch failed之类的错误时,但它也输出git-upgrade info Upgrade done,并且git status没有返回任何更改,我转到Temporary working directory的补丁,看到有一个补丁文件。此处讨论:https://github.com/facebook/react-native/issues/12112#issuecomment-284491701

在我的回购中,我按照上面的讨论应用了它,并计划解决冲突。

git apply $TMPDIR/react-native-git-upgrade/<patch file name> --reject

最新更新