1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Merge pull request #293 from erijo/submodule-upgrade

This commit is contained in:
Tim Byrne
2021-01-04 12:52:39 -06:00
2 changed files with 37 additions and 17 deletions

View File

@@ -59,12 +59,16 @@ def test_upgrade(tmpdir, runner, yadm, condition):
yadm_legacy.join(path).write(path, ensure=True)
mock_git = ""
if condition in ['tracked', 'submodules']:
if condition != 'no-paths':
mock_git = f'''
function git() {{
echo "$@"
if [[ "$*" == *.gitmodules* ]]; then
return { '0' if condition == 'submodules' else '1' }
if [[ "$*" = *"submodule status" ]]; then
{ 'echo " 1234567 mymodule (1.0)"'
if condition == 'submodules' else ':' }
fi
if [[ "$*" = *ls-files* ]]; then
return { 1 if condition == 'untracked' else 0 }
fi
return 0
}}
@@ -111,8 +115,9 @@ def test_upgrade(tmpdir, runner, yadm, condition):
assert expected in run.out
assert 'files tracked by yadm have been renamed' in run.out
if condition == 'submodules':
assert 'submodule deinit -f .' in run.out
assert 'submodule update --init --recursive' in run.out
assert 'submodule deinit -- mymodule' in run.out
assert 'submodule update --init --recursive -- mymodule' \
in run.out
else:
assert 'submodule deinit -f .' not in run.out
assert 'submodule deinit' not in run.out
assert 'submodule update --init --recursive' not in run.out