]> git.ipfire.org Git - thirdparty/git.git/blame - t/t7417-submodule-path-url.sh
t2060: add a test for switch with --orphan and --discard-changes
[thirdparty/git.git] / t / t7417-submodule-path-url.sh
CommitLineData
273c6149
JK
1#!/bin/sh
2
3test_description='check handling of .gitmodule path with dash'
4. ./test-lib.sh
5
6test_expect_success 'create submodule with dash in path' '
7 git init upstream &&
8 git -C upstream commit --allow-empty -m base &&
9 git submodule add ./upstream sub &&
10 git mv sub ./-sub &&
11 git commit -m submodule
12'
13
14test_expect_success 'clone rejects unprotected dash' '
15 test_when_finished "rm -rf dst" &&
16 git clone --recurse-submodules . dst 2>err &&
17 test_i18ngrep ignoring err
18'
19
1a7fd1fb
JK
20test_expect_success 'fsck rejects unprotected dash' '
21 test_when_finished "rm -rf dst" &&
22 git init --bare dst &&
23 git -C dst config transfer.fsckObjects true &&
24 test_must_fail git push dst HEAD 2>err &&
25 grep gitmodulesPath err
26'
27
d2c84dad
JS
28test_expect_success MINGW 'submodule paths disallows trailing spaces' '
29 git init super &&
30 test_must_fail git -C super submodule add ../upstream "sub " &&
31
32 : add "sub", then rename "sub" to "sub ", the hard way &&
33 git -C super submodule add ../upstream sub &&
34 tree=$(git -C super write-tree) &&
35 git -C super ls-tree $tree >tree &&
36 sed "s/sub/sub /" <tree >tree.new &&
37 tree=$(git -C super mktree <tree.new) &&
38 commit=$(echo with space | git -C super commit-tree $tree) &&
39 git -C super update-ref refs/heads/master $commit &&
40
41 test_must_fail git clone --recurse-submodules super dst 2>err &&
42 test_i18ngrep "sub " err
43'
44
273c6149 45test_done