Git 2.30.9
[git.git] / t / t7417-submodule-path-url.sh
blobb17d18034a3b1258ef0aa6d98b5031a14060d6f3
1 #!/bin/sh
3 test_description='check handling of .gitmodule path with dash'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
7 git config --global protocol.file.allow always
10 test_expect_success 'create submodule with dash in path' '
11 git init upstream &&
12 git -C upstream commit --allow-empty -m base &&
13 git submodule add ./upstream sub &&
14 git mv sub ./-sub &&
15 git commit -m submodule
18 test_expect_success 'clone rejects unprotected dash' '
19 test_when_finished "rm -rf dst" &&
20 git clone --recurse-submodules . dst 2>err &&
21 test_i18ngrep ignoring err
24 test_expect_success 'fsck rejects unprotected dash' '
25 test_when_finished "rm -rf dst" &&
26 git init --bare dst &&
27 git -C dst config transfer.fsckObjects true &&
28 test_must_fail git push dst HEAD 2>err &&
29 grep gitmodulesPath err
32 test_expect_success MINGW 'submodule paths disallows trailing spaces' '
33 git init super &&
34 test_must_fail git -C super submodule add ../upstream "sub " &&
36 : add "sub", then rename "sub" to "sub ", the hard way &&
37 git -C super submodule add ../upstream sub &&
38 tree=$(git -C super write-tree) &&
39 git -C super ls-tree $tree >tree &&
40 sed "s/sub/sub /" <tree >tree.new &&
41 tree=$(git -C super mktree <tree.new) &&
42 commit=$(echo with space | git -C super commit-tree $tree) &&
43 git -C super update-ref refs/heads/master $commit &&
45 test_must_fail git clone --recurse-submodules super dst 2>err &&
46 test_i18ngrep "sub " err
49 test_done