From 1655f8b89c5d08f61c2effcf2cd91baabbb75a12 Mon Sep 17 00:00:00 2001 From: Simon <oehrl@vr.rwth-aachen.de> Date: Wed, 15 Jan 2020 16:53:47 +0100 Subject: [PATCH] Fix git submodule removal --- setup.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/setup.sh b/setup.sh index 389f4aec..d7c95131 100644 --- a/setup.sh +++ b/setup.sh @@ -196,7 +196,6 @@ function manage_plugins() { then clear mkdir -p Plugins - cd Plugins echo "Adding/updating plugins..." for i in ${!plugins[@]} @@ -204,7 +203,7 @@ function manage_plugins() { # Check if plugin is already present repo_name_with_extension=${plugin_repositories[$i]##*/} repo_name=${repo_name_with_extension%*.git} - path=$(git config -f ../.gitmodules --get "submodule.Plugins/${repo_name}.path") + path=$(git config -f .gitmodules --get "submodule.Plugins/${repo_name}.path") if [ $? -ne 0 ] then plugin_present=false @@ -218,31 +217,26 @@ function manage_plugins() { then # Plugin was not yet added, call git submodule add echo "Add new plugin: ${plugins[$i]}" - git submodule add -b ${plugin_branches[$i]} ${plugin_repositories[$i]} + cd Plugins + git submodule add -f -b ${plugin_branches[$i]} ${plugin_repositories[$i]} + cd .. else # Updating existing plugin echo "Update plugin: ${plugins[$i]}" - cd $repo_name + cd Plugins/$repo_name git fetch git checkout ${plugin_branches[$i]} git pull - cd .. + cd ../.. fi else if [ "$plugin_present" == true ] then # Remove plugin! - git submodule deinit -f "$repo_name" - git rm -f "$repo_name" - - git config -f ../.gitmodules --remove-section "submodule.Plugins/${repo_name}" - if [ -z "$(cat ../.gitmodules)" ]; then - git rm -f ../.gitmodules - fi + git rm -f "Plugins/$repo_name" fi fi done - cd .. echo "Done, Press enter to continue." read x fi -- GitLab