From accec694f511105128eeb8a42d31e7736b112803 Mon Sep 17 00:00:00 2001 From: Erik Flodin Date: Sun, 3 Jan 2021 23:02:25 +0100 Subject: [PATCH] Deinit submodules before removing the repo when forcing init/clone to happen. --- test/test_init.py | 3 ++- yadm | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_init.py b/test/test_init.py index c738a02..177b907 100644 --- a/test/test_init.py +++ b/test/test_init.py @@ -60,10 +60,11 @@ def test_init( else: assert run.success assert 'Initialized empty shared Git repository' in run.out - assert run.err == '' if repo_present: assert not old_repo.isfile(), 'Original repo still exists' + else: + assert run.err == '' if alt_work: assert repo_config('core.worktree') == paths.work diff --git a/yadm b/yadm index e374329..6af23e8 100755 --- a/yadm +++ b/yadm @@ -747,6 +747,7 @@ function clone() { # remove existing if forcing the clone to happen anyway [ -d "$YADM_REPO" ] && { debug "Removing existing repo prior to clone" + "$GIT_PROGRAM" -C "$YADM_WORK" submodule deinit -f --all rm -rf "$YADM_REPO" } @@ -1129,6 +1130,7 @@ function init() { # remove existing if forcing the init to happen anyway [ -d "$YADM_REPO" ] && { debug "Removing existing repo prior to init" + "$GIT_PROGRAM" -C "$YADM_WORK" submodule deinit -f --all rm -rf "$YADM_REPO" }