Skip to content

Commit 23dd8f5

Browse files
ao2gitster
authored andcommitted
t7506: clean up .gitmodules properly before setting up new scenario
In t/t7506-status-submodule.sh at some point a new scenario is set up to test different things, in particular new submodules are added which are meant to completely replace the previous ones. However before calling the "git submodule add" commands for the new layout, the .gitmodules file is removed only from the working tree still leaving the previous content in current branch. This can break if, in the future, "git submodule add" starts differentiating between the following two cases: - .gitmodules is not in the working tree but it is in the current branch (it may not be safe to add new submodules in this case); - .gitmodules is neither in the working tree nor anywhere in the current branch (it is safe to add new submodules). Since the test intends to get rid of .gitmodules anyways, let's completely remove it from the current branch, to actually start afresh in the new scenario. This is more future-proof and does not break current tests. Signed-off-by: Antonio Ospite <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b2faad4 commit 23dd8f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t7506-status-submodule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ test_expect_success 'setup superproject with untracked file in nested submodule'
325325
(
326326
cd super &&
327327
git clean -dfx &&
328-
rm .gitmodules &&
328+
git rm .gitmodules &&
329+
git commit -m "remove .gitmodules" &&
329330
git submodule add -f ./sub1 &&
330331
git submodule add -f ./sub2 &&
331332
git submodule add -f ./sub1 sub3 &&

0 commit comments

Comments
 (0)