]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7414-submodule-mistakes.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t7414-submodule-mistakes.sh
1 #!/bin/sh
2
3 test_description='handling of common mistakes people may make with submodules'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success 'create embedded repository' '
9 git init embed &&
10 test_commit -C embed one
11 '
12
13 test_expect_success 'git-add on embedded repository warns' '
14 test_when_finished "git rm --cached -f embed" &&
15 git add embed 2>stderr &&
16 test_grep warning stderr
17 '
18
19 test_expect_success '--no-warn-embedded-repo suppresses warning' '
20 test_when_finished "git rm --cached -f embed" &&
21 git add --no-warn-embedded-repo embed 2>stderr &&
22 test_grep ! warning stderr
23 '
24
25 test_expect_success 'no warning when updating entry' '
26 test_when_finished "git rm --cached -f embed" &&
27 git add embed &&
28 git -C embed commit --allow-empty -m two &&
29 git add embed 2>stderr &&
30 test_grep ! warning stderr
31 '
32
33 test_expect_success 'submodule add does not warn' '
34 test_when_finished "git rm -rf submodule .gitmodules" &&
35 git -c protocol.file.allow=always \
36 submodule add ./embed submodule 2>stderr &&
37 test_grep ! warning stderr
38 '
39
40 test_done