Skip to content
Snippets Groups Projects
Commit 1655f8b8 authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Fix git submodule removal

parent 8138a849
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment