From: Junio C Hamano Date: Mon, 06 Mar 2023 23:57:05 GMT Subject: Re: [PATCH v2 3/6] tests: use `git submodule add` and fix expected diffs Message-ID: In-Reply-To: Glen Choo writes: > E.g. we could have ignored .gitmodules during the diff like so > > test_expect_success 'added submodule' ' > git submodule add ./sm1 && > gitmodules_hash1=$(git rev-parse --short $(git hash-object .gitmodules)) && > - git diff-index -p --submodule=log HEAD >actual && > + git diff-index -p --submodule=log HEAD -- :!.gitmodules >actual && > > and then we wouldn't have to adjust the diff. That would be my preferred > approach, since it keeps the irrelevant details out of the test. Yes, it certainly does make the diff simpler to read, but the reasoning cuts both ways. The end-goal of the topic is to propose that updating .gitmodules is an integral part of "adding a submodule" and to make it impossible to just add gitlink without a command line option using "git add", so from that point of view, readers would expect that the diff after "adding a submodule" to have both new gitlink and also a modified (or if this were the first submodule, added) ".gitmodules" file.