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() { ...@@ -196,7 +196,6 @@ function manage_plugins() {
then then
clear clear
mkdir -p Plugins mkdir -p Plugins
cd Plugins
echo "Adding/updating plugins..." echo "Adding/updating plugins..."
for i in ${!plugins[@]} for i in ${!plugins[@]}
...@@ -204,7 +203,7 @@ function manage_plugins() { ...@@ -204,7 +203,7 @@ function manage_plugins() {
# Check if plugin is already present # Check if plugin is already present
repo_name_with_extension=${plugin_repositories[$i]##*/} repo_name_with_extension=${plugin_repositories[$i]##*/}
repo_name=${repo_name_with_extension%*.git} 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 ] if [ $? -ne 0 ]
then then
plugin_present=false plugin_present=false
...@@ -218,31 +217,26 @@ function manage_plugins() { ...@@ -218,31 +217,26 @@ function manage_plugins() {
then then
# Plugin was not yet added, call git submodule add # Plugin was not yet added, call git submodule add
echo "Add new plugin: ${plugins[$i]}" 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 else
# Updating existing plugin # Updating existing plugin
echo "Update plugin: ${plugins[$i]}" echo "Update plugin: ${plugins[$i]}"
cd $repo_name cd Plugins/$repo_name
git fetch git fetch
git checkout ${plugin_branches[$i]} git checkout ${plugin_branches[$i]}
git pull git pull
cd .. cd ../..
fi fi
else else
if [ "$plugin_present" == true ] if [ "$plugin_present" == true ]
then then
# Remove plugin! # Remove plugin!
git submodule deinit -f "$repo_name" git rm -f "Plugins/$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
fi fi
fi fi
done done
cd ..
echo "Done, Press enter to continue." echo "Done, Press enter to continue."
read x read x
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment