Subject: Re: [PATCH v2] submodule: absorb git dir instead of dying on deinit

From: Junio C Hamano <[email-masked]>
Date: Fri, 27 Aug 2021 10:28:51 -0700

Atharva Raykar <[email-masked]> writes:

> "Mugdha Pattnaik via GitGitGadget" <[email-masked]> writes:
>
>> From: mugdha <[email-masked]>
>>
>> Currently, running 'git submodule deinit' on repos where the
>> submodule's '.git' is a folder aborts with a message that is not
>> exactly user friendly. Let's change this to instead warn the user
>> to rerun the command with '--force'.
>
> This makes sense, a lot of commands seem to follow this pattern of
> requiring a user to '--force' when the behaviour might not be different
> from what is normally expected.
>
>> This internally calls 'absorb_git_dir_into_superproject()', which
>> moves the '.git' folder into the superproject and replaces it with
>> a '.git' file. The rest of the deinit function can operate as it
>> already does with new-style submodules.
>
> Nice. Just like what the NEEDSWORK comment suggested.

Indeed.  Many use of the word "folder", especially when the thing is
called "git dir" in the title, irritates me, though.  We use files
and directories, not folders.

> BTW, I see you linked downthread the documentation[1] which says:
>
>   When [old-form submodules] deinitialized or deleted (see below), the
>   submodule’s Git directory is automatically moved to
>   $GIT_DIR/modules/<name>/ of the superproject.
>
> This was not what Git was doing before this patch, it used to die() out
> instead. So I think this actually is a bug fix (although I am not sure
> why the test suite also did not agree with the documentation).

Curious.

I see the description was added by d4803455 (submodules: overhaul
documentation, 2017-06-22), which claimed to "detangle" by "move"
various existing pieces of documentation into a new file.

I guess we added a wish without marking it as such ;-)