32 lines
631 B
Bash
Executable File
32 lines
631 B
Bash
Executable File
#!/bin/bash
|
|
|
|
add-git-folder() {
|
|
if [[ -z "$1" ]]; then
|
|
echo '$1/branch is empty.'
|
|
exit
|
|
fi
|
|
if [[ -z "$2" ]]; then
|
|
echo '$2/url is empty.'
|
|
exit
|
|
fi
|
|
if [[ -z "$3" ]]; then
|
|
echo '$3/path is empty.'
|
|
exit
|
|
fi
|
|
|
|
# Add to .gitmodules
|
|
git submodule add -f -b "$1" "$2" "$3"
|
|
|
|
# Ensure branch is Odoo version
|
|
git -C "$3" switch "$1"
|
|
|
|
# Save version
|
|
save-version
|
|
|
|
# Restore staged submodule files
|
|
git restore --staged .gitmodules "$3"
|
|
|
|
# Remove from working tree
|
|
# rm -rf .git/modules/"$2" || true
|
|
# git rm --cached "$2" || true
|
|
} |