首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >react-native-git-upgrade失败,命令'git diff --binary --no-color HEAD~1 HEAD‘退出,代码为空

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

Stack Overflow用户
提问于 2018-10-21 14:09:32
回答 1查看 971关注 0票数 0

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

代码语言:javascript
复制
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/`中的两个文件

代码语言:javascript
复制
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之后,我得到

代码语言:javascript
复制
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目录中没有任何更改,但临时工作目录中有一个修补程序

EN

回答 1

Stack Overflow用户

发布于 2018-10-21 15:01:22

基于此链接,该链接表明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

在我的repo中,我按照上面的讨论应用了它,并计划修复冲突。

代码语言:javascript
复制
git apply $TMPDIR/react-native-git-upgrade/<patch file name> --reject
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52912579

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档