Skip to content

Commit f9d3c54

Browse files
committed
Remove hardcoding default branch as "master"
Default branch of repo could be "master", "main" or any names. Stop hardcoding "master" as the default to clone and let "git" decide it automatically.
1 parent 108f76b commit f9d3c54

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scripts/install_plugins.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ else # shell output functions
1313
fi
1414

1515
clone() {
16-
local plugin="$1"
17-
cd "$(tpm_path)" &&
18-
GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" >/dev/null 2>&1
16+
local plugin="$1" branch="$2"
17+
if [ -n "$branch" ]; then
18+
cd "$(tpm_path)" &&
19+
GIT_TERMINAL_PROMPT=0 git clone -b "$branch" --single-branch --recursive "$plugin" >/dev/null 2>&1
20+
else
21+
cd "$(tpm_path)" &&
22+
GIT_TERMINAL_PROMPT=0 git clone --single-branch --recursive "$plugin" >/dev/null 2>&1
23+
fi
1924
}
2025

2126
# tries cloning:
@@ -30,8 +35,7 @@ clone_plugin() {
3035

3136
# clone plugin and produce output
3237
install_plugin() {
33-
local plugin="$1"
34-
local branch=`[ -z "$2" ] && echo "master" || echo "$2"`
38+
local plugin="$1" branch="$2"
3539
local plugin_name="$(plugin_name_helper "$plugin")"
3640

3741
if plugin_already_installed "$plugin"; then

0 commit comments

Comments
 (0)