Re: git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 29 Jan 2017 17:00:22 -0800
Junio C Hamano <gitster@xxxxxxxxx> wrote:

> I suspect the submodule folks would say it is working as intended,
> if \
> 
>  - you made a commit in the submodule;
>  - recorded the resulting commit in the superproject;
>  - you amended the commit in the submodule; and then
>  - you did "push, while pushing out in the submodule as needed" from
>    the superproject.

This is not what I'm doing.
This is what I'm doing (see my script):

  - you made a commit in the submodule;
  - recorded the resulting commit in the superproject;
  - you amended the commit in the submodule;
  - you record the amended commit in the superproject;  <=== !
  - you push the submodule out (or not, the on-demand does that
    anyway)
  - you try to push the superproject, but that fails,
    as long as you use recurseSubmodules=on-demand.

> 
> There are two commits in the submodule that are involved in the
> above scenario, and the first one before amending is needed by the
> other participants of the project in order for them to check out
> what you are trying to push in the superproject, because that is
> what the superproject's tree records.

I never pushed anything of that, so the other participants don't
know, nor have, the pre-amended commit.

It is true that the superproject THINKS that the pre-amended commit
is a normal commit though: the last recorded (amended) commit is
internally listed as being on top of the amended commit (which is
incorrect). This is why the superproject assumes that the current
add commit of the submodule needs the pre-amended commit to be
available too. This is not correct however, it is not needed to
be available to others and does not need to be pushed to a remote.

> I think you have two options.
> 
>  1. If the amend was done to improve things in submodule but is not
>     quite ready, then get rid of that amended commit and restore the
>     branch in the submodule to the state before you amended, i.e.
>     the tip of the branch will become the same commit as the one
>     that is recorded in the superproject.  Then push the submodule
>     and the superproject out.  After that, move the submodule branch
>     to point at the amended commit (or record the amended commit as
>     a child of the commit you pushed out).

That would work, but would be a horrible workaround for an existing
bug :p

>  2. If the amend is good and ready to go, "git add" to update the
>     superproject to make that amended result the one that is needed
>     in the submodule.

This was already done, also in the script that I provided.
Yet, the push in the superproject is still rejected.

-- 
Carlo Wood <carlo@xxxxxxxxxx>



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]