Skip to content

Commit 84069fc

Browse files
tfidfwastakengitster
authored andcommitted
t7400: test failure to add submodule in tracked path
Add a test to ensure failure on adding a submodule to a directory with tracked contents in the index. As we are going to refactor and port to C some parts of `git submodule add`, let's add a test to help ensure no regression is introduced. Signed-off-by: Atharva Raykar <[email protected]> Mentored-by: Christian Couder <[email protected]> Based-on-patch-by: Shourya Shukla <[email protected]> Mentored-by: Shourya Shukla <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ebf3c04 commit 84069fc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t7400-submodule-basic.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ test_expect_success 'submodule add to .gitignored path with --force' '
196196
)
197197
'
198198

199+
test_expect_success 'submodule add to path with tracked content fails' '
200+
(
201+
cd addtest &&
202+
echo "'\''dir-tracked'\'' already exists in the index" >expect &&
203+
mkdir dir-tracked &&
204+
test_commit foo dir-tracked/bar &&
205+
test_must_fail git submodule add "$submodurl" dir-tracked >actual 2>&1 &&
206+
test_cmp expect actual
207+
)
208+
'
209+
199210
test_expect_success 'submodule add to reconfigure existing submodule with --force' '
200211
(
201212
cd addtest-ignore &&

0 commit comments

Comments
 (0)