Re: [PATCH 5/8] submodule API & "absorbgitdirs": remove "----recursive" option
- From
Glen Choo <chooglen@google.com>
- Date
- Nov 4, 2022, 17:08 UTC
- Message-ID
- <kl6l5yfuy7ew.fsf@chooglen-macbookpro.roam.corp.google.com>
- In-Reply-To
- <221104.86fsezze6p.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 50 quoted lines
> On Thu, Nov 03 2022, Glen Choo wrote:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> Remove the "----recursive" option to "git submodule--helper
>>> absorbgitdirs" (yes, with 4 dashes, not 2).
>>
>> o.O
>>
>> At least this makes it pretty easy to grep for usage, and it makes sense
>> that we've never used it (otherwise this would've been caught).
>>
>>> diff --git a/submodule.c b/submodule.c
>>> index fe1e3f03905..8fa2ad457b2 100644
>>> --- a/submodule.c
>>> +++ b/submodule.c
>>> @@ -2332,8 +2331,7 @@ static void absorb_git_dir_into_superproject_recurse(const char *path)
>>> * having its git directory within the working tree to the git dir nested
>>> * in its superprojects git dir under modules/.
>>> */
>>> -void absorb_git_dir_into_superproject(const char *path,
>>> - unsigned flags)
>>> +void absorb_git_dir_into_superproject(const char *path)
>>> {
>>> int err_code;
>>> const char *sub_git_dir;
>>> @@ -2382,12 +2380,7 @@ void absorb_git_dir_into_superproject(const char *path,
>>> }
>>> strbuf_release(&gitdir);
>>>
>>> - if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
>>> - if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
>>> - BUG("we don't know how to pass the flags down?");
>>> -
>>> - absorb_git_dir_into_superproject_recurse(path);
>>> - }
>>> + absorb_git_dir_into_superproject_recurse(path);
>>> }
>>
>> Maybe I'm misreading, but I don't follow this change.
>>
>> Before, we recursed into the submodule only if the
>> ABSORB_GITDIR_RECURSE_SUBMODULES flag is set (which we now know is
>> never), but now we unconditionally recurse into the submodule.
>
> No, it's always set. I.e. ----recursive did nothing, but the default was
> to always set ABSORB_GITDIR_RECURSE_SUBMODULES, so it was never not-set
> (and there was no --no---recursive user).
>
> So we should be unconditionally going on this recursive path.Ah, because we initialize flags to ABSORB_GITDIR_RECURSE_SUBMODULES. I see that this is also covered by t/t7412-submodule-absorbgitdirs.sh, which has a few nested submodules tests. Thanks!
Since it's clear that recursing should be unconditional, I think we don't need the previous patch, but I'm fine either way.