blob: 3214d9db97d9bcedf86de0cfed611517cfbf58f5 [file] [log] [blame]
Stefan Beller2d81c482017-01-09 15:16:50 -08001#!/bin/sh
2
3test_description='test case exclude pathspec'
4
Ævar Arnfjörð Bjarmason87a68342022-09-01 01:14:13 +02005TEST_PASSES_SANITIZE_LEAK=true
Stefan Beller2d81c482017-01-09 15:16:50 -08006. ./test-lib.sh
7
8test_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 Blau0f21b8f2022-07-29 15:21:18 -040013 git -c protocol.file.allow=always submodule add ./pretzel sub &&
Stefan Beller2d81c482017-01-09 15:16:50 -080014 git commit -a -m "add submodule" &&
15 git submodule deinit --all
16'
17
18cat <<EOF >expect
19fatal: Pathspec 'sub/a' is in submodule 'sub'
20EOF
21
22test_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ð Bjarmason1108cea2021-02-11 02:53:53 +010025 test_cmp expect actual
Stefan Beller2d81c482017-01-09 15:16:50 -080026'
27
Stefan Beller2d81c482017-01-09 15:16:50 -080028test_expect_success 'error message for path inside submodule from within submodule' '
29 test_must_fail git -C sub add . 2>actual &&
Brandon Williamsbdab9722017-05-09 12:17:59 -070030 test_i18ngrep "in unpopulated submodule" actual
Stefan Beller2d81c482017-01-09 15:16:50 -080031'
32
33test_done