Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test case exclude pathspec' |
| 4 | |
Ævar Arnfjörð Bjarmason | 87a6834 | 2022-09-01 01:14:13 +0200 | [diff] [blame] | 5 | TEST_PASSES_SANITIZE_LEAK=true |
Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 6 | . ./test-lib.sh |
| 7 | |
| 8 | test_expect_success 'setup a submodule' ' |
| 9 | test_create_repo pretzel && |
| 10 | : >pretzel/a && |
| 11 | git -C pretzel add a && |
| 12 | git -C pretzel commit -m "add a file" -- a && |
Taylor Blau | 0f21b8f | 2022-07-29 15:21:18 -0400 | [diff] [blame] | 13 | git -c protocol.file.allow=always submodule add ./pretzel sub && |
Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 14 | git commit -a -m "add submodule" && |
| 15 | git submodule deinit --all |
| 16 | ' |
| 17 | |
| 18 | cat <<EOF >expect |
| 19 | fatal: Pathspec 'sub/a' is in submodule 'sub' |
| 20 | EOF |
| 21 | |
| 22 | test_expect_success 'error message for path inside submodule' ' |
| 23 | echo a >sub/a && |
| 24 | test_must_fail git add sub/a 2>actual && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 25 | test_cmp expect actual |
Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 26 | ' |
| 27 | |
Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 28 | test_expect_success 'error message for path inside submodule from within submodule' ' |
| 29 | test_must_fail git -C sub add . 2>actual && |
Brandon Williams | bdab972 | 2017-05-09 12:17:59 -0700 | [diff] [blame] | 30 | test_i18ngrep "in unpopulated submodule" actual |
Stefan Beller | 2d81c48 | 2017-01-09 15:16:50 -0800 | [diff] [blame] | 31 | ' |
| 32 | |
| 33 | test_done |