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.