Skip to content

Commit

Permalink
Merge pull request #141 from killjoy1221/fix/update-with-main-branch
Browse files Browse the repository at this point in the history
Un-hardcode the master branch in plugin updates
  • Loading branch information
josegonzalez committed May 18, 2024
2 parents 00952f5 + 02b39c5 commit 54b916c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bashenv/plugn.bash
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ update() {
fi

[[ -z "$committish" ]] && [[ ! $(git symbolic-ref HEAD) ]] && echo "Plugin pinned to $(< ./.plugin_committish)" && exit 0
git checkout master &> /dev/null
git pull &> /dev/null
git checkout - &> /dev/null
git fetch &> /dev/null
if [[ -n "$committish" ]]; then
git fetch --tags &> /dev/null
git checkout $committish &> /dev/null
git checkout "$committish" &> /dev/null
git pull &> /dev/null || true # in case of branches
echo "$committish" > ./.plugin_committish
echo "Plugin ($plugin) updated and pinned to $committish"
else
git pull &> /dev/null
echo "Plugin ($plugin) updated"
fi
popd &> /dev/null
Expand Down
11 changes: 11 additions & 0 deletions tests/functional/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ T_plugn-update() {
plugn list | grep smoke-test-plugin | grep 0.3.0-testing"
}

T_plugn-update-main() {
plugn-test-pass "test-update-main" "
plugn init && \
plugn install https://github.com/dokku/smoke-test-plugin-main && \
plugn list | grep smoke-test-plugin-main && \
plugn update smoke-test-plugin-main v0.2.0 && \
plugn list | grep smoke-test-plugin-main | grep 0.2.0 && \
plugn update smoke-test-plugin-main main && \
plugn list | grep smoke-test-plugin-main | grep 0.9.0"
}

T_plugn-version() {
plugn-test-pass "test-version" "
plugn init && \
Expand Down

0 comments on commit 54b916c

Please sign in to comment.