git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Stefan Beller <sbeller@google.com>
Date
Feb 4, 2017, 18:43 UTC
Message-ID
<CAGZ79kYXc-cT-059ZpoVrUjLodY-x61bW2ANQqtcAQLzGiRZ3A@mail.gmail.com>
In-Reply-To
<20170201021040.4f6cc827@hikaru>
On Tue, Jan 31, 2017 at 5:10 PM, Carlo Wood <carlo@alinoe.com> wrote:
Show 21 quoted lines
> On Tue, 31 Jan 2017 14:08:41 -0800
> Stefan Beller <sbeller@google.com> wrote:
>
>> On Sun, Jan 29, 2017 at 5:00 PM, Junio C Hamano <gitster@pobox.com>
>> wrote:
>> >  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.
>>
>> yup.
>
> But that is what I am doing. The amended commit IS already
> added to the superproject (and pushed to the remote).
>
> Please have a look at my script, this happens here:
>
> # Correct that in the parent too:
> pushd parent
> git add subm
> git commit -m 'Updated subm.'
> popd

And if you were to use ammend here, too; there would be no problem; In the parent there are now two commits, the first one pointing at the first (unammended) commit in the submodule, the second pointing to the corrected commit.

Show 5 quoted lines
>
> The commit from before the amend was added to the super
> project (but never pushed) but has now been completely
> replaced. I still think this is a flaw in git. It shouldn't
> not complain and simply push.

The problem here is in the design. When "on-demand" is set, the parent repo determines which sumbodules needs pushing, then runs a plain "git push" in them and then checks again.

The push operation in the submodule did not push out the un-amended commit (which is correct IMO).

The parent in the second check determines that there is a commit, that is not pushed, though. Maybe we need an option there "on-demand-but-no-recheck" as a weaker promise what Git can deliver there.

>
> --
> Carlo Wood <carlo@alinoe.com>
Previous: Carlo WoodNext: Carlo Wood
Message 5 of 6 in “git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule.”
  1. Carlo WoodJan 29, 2017
  2. Junio C HamanoJan 30, 2017
  3. Stefan BellerJan 31, 2017
  4. Carlo WoodFeb 1, 2017
  5. Stefan BellerFeb 4, 2017
  6. Carlo WoodFeb 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.