1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 08:46:18 +02:00
git/t/t7414-submodule-mistakes.sh
Taylor Blau 0d3beb71da t/t7NNN: allow local submodules
To prepare for the default value of `protocol.file.allow` to change to
"user", ensure tests that rely on local submodules can initialize them
over the file protocol.

Tests that only need to interact with submodules in a limited capacity
have individual Git commands annotated with the appropriate
configuration via `-c`. Tests that interact with submodules a handful of
times use `test_config_global` instead. Test scripts that rely on
submodules throughout use a `git config --global` during a setup test
towards the beginning of the script.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-10-01 00:23:38 -04:00

39 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
test_description='handling of common mistakes people may make with submodules'
. ./test-lib.sh
test_expect_success 'create embedded repository' '
git init embed &&
test_commit -C embed one
'
test_expect_success 'git-add on embedded repository warns' '
test_when_finished "git rm --cached -f embed" &&
git add embed 2>stderr &&
test_i18ngrep warning stderr
'
test_expect_success '--no-warn-embedded-repo suppresses warning' '
test_when_finished "git rm --cached -f embed" &&
git add --no-warn-embedded-repo embed 2>stderr &&
test_i18ngrep ! warning stderr
'
test_expect_success 'no warning when updating entry' '
test_when_finished "git rm --cached -f embed" &&
git add embed &&
git -C embed commit --allow-empty -m two &&
git add embed 2>stderr &&
test_i18ngrep ! warning stderr
'
test_expect_success 'submodule add does not warn' '
test_when_finished "git rm -rf submodule .gitmodules" &&
git -c protocol.file.allow=always \
submodule add ./embed submodule 2>stderr &&
test_i18ngrep ! warning stderr
'
test_done