Skip to content

Commit

Permalink
perf: only run ls-remote if 3rd update_plugin arg is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Dabolus committed Oct 11, 2023
1 parent fce6c53 commit 632c51f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/functions/plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,10 @@ plugin_update_command() {
update_plugin() {
local plugin_name=$1
local plugin_path=$2
plugin_remote_default_branch=$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" ls-remote --symref origin HEAD | awk '{ sub(/refs\/heads\//, ""); print $2; exit }')
local gitref=${3:-${plugin_remote_default_branch}}
local common_git_options=(--git-dir "$plugin_path/.git" --work-tree "$plugin_path")
local gitref=${3:-$(git "${common_git_options[@]}" ls-remote --symref origin HEAD | awk '{ sub(/refs\/heads\//, ""); print $2; exit }')}
logfile=$(mktemp)

local common_git_options=(--git-dir "$plugin_path/.git" --work-tree "$plugin_path")
local prev_ref=
local post_ref=
{
Expand Down

0 comments on commit 632c51f

Please sign in to comment.