git push --recurse-submodules = on-demand不是真正的递归 [英] git push --recurse-submodules=on-demand is not truly recursive

查看:971
本文介绍了git push --recurse-submodules = on-demand不是真正的递归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下项目结构:

  root-project 
|
| - A
| |
| | - C
|
| - B

A和B是根项目的子模块。 C又是项目A的子模块
。假设我已经对项目A,B和C进行了更改,
将这些更改提交给了相应的索引。之后,我更新
对root-project中的A和B的引用,并提交更改
。当我用选项
--recurse-submodules = on-demand推送root项目的更改时,git会推送项目A,
B和root项目的所有提交,但默默忽略提交
项目C.我期望它也推动项目C的更改。



我知道我可以通过使用以下两个命令在root-project文件夹中。

  git submodule foreach --recursive'git push origin master'
git push

有人可以澄清我是否做错了什么,或者这是否是git- push.I已经在git邮件列表上问过这个问题,但是没有收到任何回应: http://thread.gmane.org/gmane.comp.version-control.git/266184



我也写了一个小的shell脚本,用于设置所描述的项目结构并执行th e递归推送操作:
https://gist.github.com/usommerl/6e8defcba94bd4ba1438



git version 2.3.3

解决方案

git push --recurse-submodules = on-demand 将会真正用git 2.14.x / 2.15(2017年第3季度)递归,但有一些条件。



请参阅提交c7be720 (2017年7月20日) Brandon Williams( mbrandonw

< sup>(由 Junio C Hamano - gitster - > a>在提交a49794d ,2017年8月22日)



子模块 - helper:t每个push-check处理HEAD


06bf4ad push :使用
传播远程和refspec - 推导子模块,git 2.13.0)push被教会如何在给出' - recurse-submodules '标志时将refspec传播到子模块。


允许传播的唯一的refspecs是在超级项目和子模块中都存在的ref的名称,并带有警告

这个补丁教授push-check(子模块助手,它确定
a refspec是否可以传播到子模块)以允许传播' HEAD '
当且仅当



  • 超级项目和子模块都具有相同的
    命名分支,
  • 子模块不处于分离头状态。



I have the following project structure:

root-project
      |
      |-- A
      |   |
      |   |-- C
      |
      |-- B

A and B are submodules of the root-project. C is in turn a submodule of project A. Suppose I have made changes to projects A,B and C and commited these changes to the respective indices. After that I update the references to A and B in the root-project and commit that change as well. When I push the changes of the root-project with the option --recurse-submodules=on-demand, git pushes all commits of projects A, B and the root-project, but silently ignores the commits of project C. I would expect that it pushes the changes of project C as well.

I know that i can work around this problem by using the following two commands in the root-project folder.

git submodule foreach --recursive 'git push origin master'
git push

Could someone clarify whether I'm doing something wrong or if this is a bug in git-push.I have already asked this question on the git mailing list but didn't receive any response: http://thread.gmane.org/gmane.comp.version-control.git/266184

I have also written a small shell script that sets up the described project structure and executes the recursive push operation: https://gist.github.com/usommerl/6e8defcba94bd4ba1438

git version 2.3.3

解决方案

git push --recurse-submodules=on-demand will be truly recursive with git 2.14.x/2.15 (Q3 2017), but with some condition.

See commit c7be720 (20 Jul 2017) by Brandon Williams (mbrandonw).
(Merged by Junio C Hamano -- gitster -- in commit a49794d, 22 Aug 2017)

submodule--helper: teach push-check to handle HEAD

In 06bf4ad (push: propagate remote and refspec with --recurse-submodules, git 2.13.0) push was taught how to propagate a refspec down to submodules when the '--recurse-submodules' flag is given.

The only refspecs that are allowed to be propagated are ones which name a ref which exists in both the superproject and the submodule, with the caveat that 'HEAD' was disallowed.

This patch teaches push-check (the submodule helper which determines if a refspec can be propagated to a submodule) to permit propagating 'HEAD' if and only if:

  • the superproject and the submodule both have the same named branch checked out and
  • the submodule is not in a detached head state.

这篇关于git push --recurse-submodules = on-demand不是真正的递归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆