From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Carlo Wood <carlo@alinoe.com>, Heiko Voigt <hvoigt@hvoigt.net>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule.
Date: Tue, 31 Jan 2017 14:08:41 -0800 [thread overview]
Message-ID: <CAGZ79kbCfKVDq+9Pr5LmOtT=+uB+u+EMQg1=FUNS2umCvtvHhg@mail.gmail.com> (raw)
In-Reply-To: <xmqqvasxwee1.fsf@gitster.mtv.corp.google.com>
On Sun, Jan 29, 2017 at 5:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Carlo Wood <carlo@alinoe.com> writes:
>
>> there seems to be a problem with using 'git commit --amend' in
>> git submodules when using 'git push --recurse-submodules=on-demand'
>> in the parent.
>>
>> The latter fails, saying "The following submodule paths contain changes
>> that can not be found on any remote:" for such submodule, even though
>> the submodule is clean, pushed and reports 'Everything up-to-date'
>> when trying to push it.
>>
>> I believe that the reason has to be that the parent repository thinks
>> that the comment that was amended, but not pushed, must be on the remote
>> too, while the whole point of amend is that this commit is not pushed.
>
> I am not super familiar with the actualy implementation of the
> codepaths involved in this, so CC'ed the folks who can help you
> better.
>
> 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.
Yes, for the current state of affairs, this is it.
>
> 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. You somehow need to make that
> commit available to them, but after you amended, the original commit
> may no longer be reachable from any branch in your submodule, so
> even if you (or the "on-demand" mechanism) pushed any and all
> branches out, that would not make the needed commit available to
> others. If you push your top-level superproject out in such a
> situation, you would break others.
In the long term future, we may want to reject non-fastforward
submodule updates. (Not sure if that is feasible)
>
> 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).
>
> 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.
next prev parent reply other threads:[~2017-01-31 22:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-29 19:33 git push failing when push.recurseSubmodules on-demand and git commit --amend was used in submodule Carlo Wood
2017-01-30 1:00 ` Junio C Hamano
2017-01-31 22:08 ` Stefan Beller [this message]
2017-02-01 1:10 ` Carlo Wood
2017-02-04 18:43 ` Stefan Beller
2017-02-01 1:22 ` Carlo Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGZ79kbCfKVDq+9Pr5LmOtT=+uB+u+EMQg1=FUNS2umCvtvHhg@mail.gmail.com' \
--to=sbeller@google.com \
--cc=carlo@alinoe.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).