Subject: Re: [RFC PATCH 4/6] tests: use `git submodule add` and fix expected diffs

From: Junio C Hamano <[email-masked]>
Date: Mon, 13 Feb 2023 15:07:12 -0800

Calvin Wan <[email-masked]> writes:

> From: Josh Steadmon <[email-masked]>
>
> This commit continues the previous work of updating the test suite to
> use `git submodule add` to create submodules instead of using `git add`
> to include embedded repositories. Specifically, in this commit we update
> test cases where expected diffs must change due to the presence of a
> .gitmodules file.

Good that these "same" tasks are split into two steps, ones that
don't notice the additional presence of .gitmodules (i.e. the
previous step) and the result that do.

Strictly speaking, gitlink support in the index and trees does not
have to be used to record submodules, and changing all "git add" to
"git submodule add" is somewhat a sad change that closes the door to
those folks who want to use the mechanism for implementing "better
submodules" that do not depend on a separate .gitmodules files, for
example.  To leave the door open, "git add" may need to learn an
overriding mechanism allow adding a gitlink to the index without
anything else.  And then this step could use "git add -f" (or
whategver the overriding mechanism) instead of "git submodule add",
without changing the expected diff output.

Would such a tweak make this step better?  I dunno.

>  t/t3040-subprojects-basic.sh                 |   3 +-
>  t/t4041-diff-submodule-option.sh             | 153 ++++++++++++++++++-
>  t/t4060-diff-submodule-option-diff-format.sh | 125 +++++++++++++--
>  t/t7506-status-submodule.sh                  |  15 +-
>  4 files changed, 278 insertions(+), 18 deletions(-)