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

Re: [PATCH 2/2] submodule.c: warn about missing submodule git directories

From
Stefan Beller <sbeller@google.com>
Date
Aug 28, 2018, 21:49 UTC
Message-ID
<CAGZ79kYApAdFzC82LZNjYDzL5uWxtXHbvqUyjZ9OF+b=pGNbUA@mail.gmail.com>
In-Reply-To
<xmqqtvnefhgx.fsf@gitster-ct.c.googlers.com>
On Tue, Aug 28, 2018 at 11:56 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
>
> Stefan Beller <sbeller@google.com> writes:
>
> > This is the continuation of f2d48994dc1 (submodule.c: submodule_move_head
> > works with broken submodules, 2017-04-18), which tones down the case of
> > "broken submodule" in case of a missing git directory of the submodule to
> > be only a warning.
>
> After seeing this warning, as we do not do any remedial action in
> this codepath, the user with a repository in this state will keep
> seeing the 'missing' message.  Wouldn't we want to give a hint in
> addition (e.g. 'you can run "git submodule update $name" to
> recover', or something like that)?

Not quite, as this is only triggered in the case of 'old_head = NULL', which is when you have a superproject that is missing the submodule in the working tree before and wants to have it afterwards.

Looking at the test in the previous patch, I would think a reasonable workflow in the test is

    git clone --recurse-submodules super1 super1_clone && cd super1_clone
    git checkout --recurse-submodules historic_state
    # see warning, but checkout proceeds
    git fetch --recurse-submodules
    # clones the submodule as it was configured active via the clone
    git checkout --recurse-submodules historic_state
    # this checkout will put the submodule in place
    #  not sure if -f is needed here, though.

I am currently working on the cloning of submodules that are not currently in the working tree while fetching in the superproject, which would address the latter part.

> The MOVE_HEAD_FORCE codepath that follows this hunk is, eh, already
> forcing to correct the situation, so there is no need to touch that,
> which makes sense, if I understand correctly.
No, that is not executed for now as it depends on 'old_head'.
In case of FORCE we might want to die instead of just warn about that submodule.
Stefan
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 10 in “t2013: add test for missing but active submodule”
  1. 1/2 t2013: add test for missing but active submoduleStefan Beller, Aug 27, 2018
  2. 2/2 submodule.c: warn about missing submodule git directoriesStefan Beller, Aug 27, 2018
  3. Junio C HamanoAug 28, 2018
  4. Stefan BellerAug 28, 2018
  5. Junio C HamanoAug 29, 2018
  6. Stefan BellerAug 29, 2018
  7. Jonathan NiederSep 5, 2018
  8. Stefan BellerSep 7, 2018
  9. Jonathan NiederSep 7, 2018
  10. SZEDER GáborAug 29, 2018

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.