]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t7416-submodule-dash-url.sh
3 test_description
='check handling of .gitmodule url with dash'
6 test_expect_success
'create submodule with protected dash in url' '
8 git -C upstream commit --allow-empty -m base &&
9 mv upstream ./-upstream &&
10 git submodule add ./-upstream sub &&
11 git add sub .gitmodules &&
12 git commit -m submodule
15 test_expect_success
'clone can recurse submodule' '
16 test_when_finished "rm -rf dst" &&
17 git clone --recurse-submodules . dst &&
19 git -C dst/sub log -1 --format=%s >actual &&
20 test_cmp expect actual
23 test_expect_success
'remove ./ protection from .gitmodules url' '
24 perl -i -pe "s{\./}{}" .gitmodules &&
25 git commit -am "drop protection"
28 test_expect_success
'clone rejects unprotected dash' '
29 test_when_finished "rm -rf dst" &&
30 test_must_fail git clone --recurse-submodules . dst 2>err &&
31 test_i18ngrep ignoring err
34 test_expect_success
'trailing backslash is handled correctly' '
35 git init testmodule &&
36 test_commit -C testmodule c &&
37 git submodule add ./testmodule &&
38 : ensure that the name ends in a double backslash &&
39 sed -e "s|\\(submodule \"testmodule\\)\"|\\1\\\\\\\\\"|" \
40 -e "s|url = .*|url = \" --should-not-be-an-option\"|" \
42 mv .new .gitmodules &&
43 git commit -am "Add testmodule" &&
44 test_must_fail git clone --verbose --recurse-submodules . dolly 2>err &&
45 test_i18ngrep ! "unknown option" err