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

Re: [PATCHv5 4/4] rm: absorb a submodules git dir before deletion

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 27, 2016, 21:55 UTC
Message-ID
<xmqqeg0t6nqj.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kZLk2bNj2Z_PFfo9KzODn8nSihDLdLuKvpSPodR9Eg-4w@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 27 quoted lines
>>>> @@ -358,9 +331,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
>>>>                       oidclr(&oid);
>>>>               if (check_local_mod(&oid, index_only))
>>>>                       exit(1);
>>>> -     } else if (!index_only) {
>>>> -             if (check_submodules_use_gitfiles())
>>>> -                     exit(1);
>>>>       }
>>>>
>>>
>>> Hmph.  It may be a bit strange to see an "index-only" remove to
>>> touch working tree, no?  Yet submodules_absorb_gitdir_if_needed() is
>>> unconditionally called above, which feels somewhat unexpected.
>> ...
> Well scratch that.
> is_staging_gitmodules_ok only checks for the .gitmodules file and not
> for the submodule itself (the submodule is not an argument to that function)
>
> The actual answer is found in check_local_mod called via
>
>     if (!force) {
>         struct object_id oid;
>         if (get_oid("HEAD", &oid))
>             oidclr(&oid);
>         if (check_local_mod(&oid, index_only))
>             exit(1);
>     }

OK, that happens way before this loop starts finding submodules and removing them, so we can say that the latter is well protected.

Thanks.
Previous: Stefan Beller
Message 13 of 13 in “[PATCHv5 0/4] git-rm absorbs submodule git directory before deletion”
  1. Stefan BellerDec 20, 2016
  2. 1/4 submodule.h: add extern keyword to functionsStefan Beller, Dec 20, 2016
  3. Junio C HamanoDec 27, 2016
  4. Stefan BellerDec 27, 2016
  5. 2/4 submodule: modernize ok_to_remove_submodule to use argv_arrayStefan Beller, Dec 20, 2016
  6. 3/4 submodule: rename and add flags to ok_to_remove_submoduleStefan Beller, Dec 20, 2016
  7. Junio C HamanoDec 27, 2016
  8. Stefan BellerDec 27, 2016
  9. 4/4 rm: absorb a submodules git dir before deletionStefan Beller, Dec 20, 2016
  10. Junio C HamanoDec 27, 2016
  11. Stefan BellerDec 27, 2016
  12. Stefan BellerDec 27, 2016
  13. Junio C HamanoDec 27, 2016

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.