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

Re: [PATCHv2 4/4] builtin/reset: add --recurse-submodules switch

From
Stefan Beller <sbeller@google.com>
Date
Apr 19, 2017, 19:08 UTC
Message-ID
<CAGZ79kZ4oJcCD5QttcSzkfTVotust8vnBmSbp0sh5PrpqMQgJw@mail.gmail.com>
In-Reply-To
<xmqqfuh5av47.fsf@gitster.mtv.corp.google.com>
On Tue, Apr 18, 2017 at 9:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> git-reset is yet another working tree manipulator, which should
>> be taught about submodules.
>>
>> One use case of "git-reset" is to reset to a known good state,
>> and dropping commits that did not work as expected.
>>
>> In that case one of the expected outcomes from a hard reset
>> would be to have broken submodules reset to a known good
>> state as well.  A test for this was added in a prior patch.
>
> When "git reset --hard" at the top-level superproject updates a
> gitlink in the index to a commit that was different from what was
> checked out in the working tree of the submodule, what should
> happen?

We reset the submodule to the commit as recorded in the superproject, detaching its HEAD.

Show 8 quoted lines
>  Do we reset the tip of the current branch in the submodule
> to point at the commit the index of the top-level records?  Do we
> detach the HEAD in the submodule to point at the commit?  Something
> else that is configurable?  Or do we just run "git reset --hard"
> in each submodule (which may leave submodule's HEAD different from
> what is recorded in the index of the superproject)?
>
> "... to a known good state as well" does not help answering the above.
I agree.
>
Previous: Junio C HamanoNext: Stefan Beller
Message 7 of 10 in “[PATCHv2 0/4] recursive submodules: git-reset!”
  1. Stefan BellerApr 18, 2017
  2. 1/4 entry.c: submodule recursing: respect force flag correctlyStefan Beller, Apr 18, 2017
  3. 2/4 submodule.c: uninitialized submodules are ignored in recursive commandsStefan Beller, Apr 18, 2017
  4. 3/4 submodule.c: submodule_move_head works with broken submodulesStefan Beller, Apr 18, 2017
  5. 4/4 builtin/reset: add --recurse-submodules switchStefan Beller, Apr 18, 2017
  6. Junio C HamanoApr 19, 2017
  7. Stefan BellerApr 19, 2017
  8. 4/4 builtin/reset: add --recurse-submodules switchStefan Beller, Apr 21, 2017
  9. Brandon WilliamsApr 20, 2017
  10. Stefan BellerApr 20, 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.