Stefan Beller <sbel...@google.com> writes:

>>>> @@ -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.

Reply via email to