Merge branch 'master' into ban-process-substitution

This commit is contained in:
James Hegedus 2021-04-27 19:34:35 +10:00 committed by GitHub
commit 10d9c1218e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 166 additions and 48 deletions

View File

@ -20,13 +20,17 @@ details like asdf version, shell, OS, etc...
## Did you write a patch that fixes a bug? ## Did you write a patch that fixes a bug?
Open a new GitHub pull request with the patch. Refer to the [Development Open a new GitHub pull request with the patch. Refer to the [Development
section of the README](http://asdf-vm.github.io/asdf/#/contributing-core-asdf-vm) for the section of the README](http://asdf-vm.github.io/asdf/#/contributing-core-asdf) for the
details on how to run the unit tests. Please make sure that unit tests pass on details on how to run the unit tests. Please make sure that unit tests pass on
Travis CI. Travis CI.
Pull request must contain changes that add new features, fix bugs, or fix
incorrect documentation. Unsolicited pull requests that only contain formatting
changes like indentation, or line length, or letter case will be rejected.
## Did you create a plugin for asdf? ## Did you create a plugin for asdf?
Please read the [creating plugins](docs/creating-plugins.md) guide. Please read the [creating plugins](docs/plugins-create.md) guide.
## Do you want to contribute the asdf documentation? ## Do you want to contribute the asdf documentation?

View File

@ -17,7 +17,7 @@ asdf is a CLI tool that can manage multiple language runtime versions on a per-p
## Documentation ## Documentation
[Please head over the documentation site for more information](https://asdf-vm.github.io/asdf/)! [Please head over to the documentation site for more information](https://asdf-vm.github.io/asdf/)!
- [Getting Started](https://asdf-vm.github.io/asdf/#/core-manage-asdf) - [Getting Started](https://asdf-vm.github.io/asdf/#/core-manage-asdf)
- [All Commands](https://asdf-vm.github.io/asdf/#/core-commands) - [All Commands](https://asdf-vm.github.io/asdf/#/core-commands)
@ -27,11 +27,10 @@ asdf is a CLI tool that can manage multiple language runtime versions on a per-p
## Contributing ## Contributing
See [CONTRIBUTING.md in the repo](https://github.com/asdf-vm/asdf/blob/master/CONTRIBUTING.md) or the [Contributing section on the docs site](http://asdf-vm.github.io/asdf/#/contributing-core-asdf-vm). See [CONTRIBUTING.md in the repo](https://github.com/asdf-vm/asdf/blob/master/CONTRIBUTING.md) or the [Contributing section on the docs site](http://asdf-vm.github.io/asdf/#/contributing-core-asdf).
## Community & Questions ## Community & Questions
<!-- - [![GitHub Discussions](https://icongram.jgog.in/simple/github.svg?color=808080&size=16)Github Discussions TBA](https://github.com/asdf-vm/asdf/discussions): our preferred method for community Q&A and interaction --> - [![GitHub Issues](https://icongr.am/simple/github.svg?color=808080&size=16) GitHub Issues](https://github.com/asdf-vm/asdf/issues): report a bug or raise a feature request to the `asdf` core team
- [![GitHub Discussions](https://icongr.am/simple/github.svg?color=808080&size=16) GitHub Discussions](https://github.com/asdf-vm/asdf/discussions): our preferred method for community Q&A and interaction
- [![Github Issues](https://icongram.jgog.in/simple/github.svg?color=808080&size=16) Github Issues](https://github.com/asdf-vm/asdf/issues): report a bug or raise a feature request to the `asdf` core team
- [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080) StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm): see existing Q&A for `asdf`. Some of the core team watch this tag in addition to our helpful community - [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080) StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm): see existing Q&A for `asdf`. Some of the core team watch this tag in addition to our helpful community

View File

@ -12,7 +12,8 @@ updating to the latest version of asdf will be required.
| Version | Supported | | Version | Supported |
| ------- | ------------------ | | ------- | ------------------ |
| 0.7.x | :white_check_mark: | | 0.8.x | :white_check_mark: |
| 0.7.x | :x: |
| 0.6.x | :x: | | 0.6.x | :x: |
| 0.5.x | :x: | | 0.5.x | :x: |
| 0.4.x | :x: | | 0.4.x | :x: |
@ -26,4 +27,5 @@ To report a vulnerability please contact one of:
* @Stratus3D via email: see https://stratus3d.com/contact/ for email. PGP is not setup for this email address. * @Stratus3D via email: see https://stratus3d.com/contact/ for email. PGP is not setup for this email address.
* @danhper via email: see https://daniel.perez.sh/ for email and PGP key * @danhper via email: see https://daniel.perez.sh/ for email and PGP key
* @jthegedus via email: see https://github.com/jthegedus for email. PGP is not setup for this email address.
* TODO: Add secure contact methods of others on the core team. * TODO: Add secure contact methods of others on the core team.

View File

@ -76,6 +76,21 @@ _asdf__installed_versions_of() {
compadd -a versions compadd -a versions
} }
_asdf__installed_versions_of_plus_system() {
local plugin_dir="${asdf_dir:?}/installs/${1:?need a plugin version}"
if [[ ! -d "$plugin_dir" ]]; then
_wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \
compadd -x "no versions installed"
return
fi
local -a versions
versions=( "$plugin_dir"/*(:t) )
versions+="system"
_wanted "asdf-versions-$1" expl "ASDF Plugin ${(q-)1} versions" \
compadd -a versions
}
local -i IntermediateCount=0 local -i IntermediateCount=0
if (( CURRENT == 2 )); then if (( CURRENT == 2 )); then
@ -165,10 +180,14 @@ case "$subcmd" in
compadd -- $(asdf list-all "$pkg" "$query") compadd -- $(asdf list-all "$pkg" "$query")
fi fi
;; ;;
(uninstall|shell|local|global|reshim) (uninstall|reshim)
compset -n 2 compset -n 2
_arguments '1:plugin-name: _asdf__installed_plugins' '2:package-version:{_asdf__installed_versions_of ${words[2]}}' _arguments '1:plugin-name: _asdf__installed_plugins' '2:package-version:{_asdf__installed_versions_of ${words[2]}}'
;; ;;
(shell|local|global)
compset -n 2
_arguments '1:plugin-name: _asdf__installed_plugins' '2:package-version:{_asdf__installed_versions_of_plus_system ${words[2]}}'
;;
(where) (where)
# version is optional # version is optional
compset -n 2 compset -n 2

View File

@ -44,7 +44,7 @@ _asdf() {
# shellcheck disable=SC2207 # shellcheck disable=SC2207
COMPREPLY=($(compgen -W "--head" -- "$cur")) COMPREPLY=($(compgen -W "--head" -- "$cur"))
;; ;;
uninstall | where | reshim | local | global | shell) uninstall | where | reshim)
if [[ "$plugins" == *"$prev"* ]]; then if [[ "$plugins" == *"$prev"* ]]; then
local versions local versions
versions=$(asdf list "$prev" 2>/dev/null) versions=$(asdf list "$prev" 2>/dev/null)
@ -55,6 +55,18 @@ _asdf() {
COMPREPLY=($(compgen -W "$plugins" -- "$cur")) COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
fi fi
;; ;;
local | global | shell)
if [[ "$plugins" == *"$prev"* ]]; then
local versions
versions=$(asdf list "$prev" 2>/dev/null)
versions+=" system"
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
else
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
fi
;;
*) *)
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which info' local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which info'
# shellcheck disable=SC2207 # shellcheck disable=SC2207

View File

@ -1,2 +1,3 @@
- Translations - Translations
- [:uk: English](/) - [:uk: English](/)
- [Add translation](contributing-doc-site?id=translations)

View File

@ -15,6 +15,6 @@
- [Documentation Site](contributing-doc-site) - [Documentation Site](contributing-doc-site)
- [Thanks](thanks) - [Thanks](thanks)
- **Community & Questions** - **Community & Questions**
- [![Github Issues](https://icongram.jgog.in/simple/github.svg?color=808080&size=16)Github Issues](https://github.com/asdf-vm/asdf/issues) - [![GitHub Issues](https://icongr.am/simple/github.svg?color=808080&size=16) GitHub Issues](https://github.com/asdf-vm/asdf/issues)
- [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080)StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm) - [![GitHub Discussions](https://icongr.am/simple/github.svg?color=808080&size=16) GitHub Discussions](https://github.com/asdf-vm/asdf/discussions)
<!-- - [![GitHub Discussions](https://icongram.jgog.in/simple/github.svg?color=808080&size=16)Github Discussions TBA](https://github.com/asdf-vm/asdf/discussions) --> - [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080) StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm)

View File

@ -6,7 +6,7 @@ If you want to try out your changes without making change to your installed `asd
Tools we use: Tools we use:
- [bats](https://github.com/sstephenson/bats) for testing. Make sure - [bats](https://github.com/bats-core/bats-core) for testing. Make sure
`bats test/` passes after you made your changes. `bats test/` passes after you made your changes.
- [Shellcheck](https://github.com/koalaman/shellcheck) for static analysis of our shell scripts. - [Shellcheck](https://github.com/koalaman/shellcheck) for static analysis of our shell scripts.

View File

@ -49,5 +49,6 @@ legacy_version_file = yes
## Environment Variables ## Environment Variables
- `ASDF_CONFIG_FILE` - Defaults to `~/.asdfrc` as described above. Can be set to any location. - `ASDF_CONFIG_FILE` - Defaults to `~/.asdfrc` as described above. Can be set to any location.
- `ASDF_DEFAULT_TOOL_VERSIONS_FILENAME` - The name of the file storing the tool names and versions. Defaults to `.tool-versions`. Can be any valid file name. - `ASDF_DEFAULT_TOOL_VERSIONS_FILENAME` - The filename of the file storing the tool names and versions. Defaults to `.tool-versions`. Can be any valid filename. Typically you should not override the default value unless you know you want asdf to ignore `.tool-versions` files.
- `ASDF_DIR` - Defaults to `~/.asdf` - Location of the `asdf` scripts. If you install `asdf` to some other directory, set this to that directory. For example, if you are installing via the AUR, you should set this to `/opt/asdf-vm`.
- `ASDF_DATA_DIR` - Defaults to `~/.asdf` - Location where `asdf` install plugins, shims and installs. Can be set to any location before sourcing `asdf.sh` or `asdf.fish` mentioned in the section above. - `ASDF_DATA_DIR` - Defaults to `~/.asdf` - Location where `asdf` install plugins, shims and installs. Can be set to any location before sourcing `asdf.sh` or `asdf.fish` mentioned in the section above.

View File

@ -121,7 +121,7 @@ source ~/.asdf/asdf.fish
?> Completions must be configured manually with the following command: ?> Completions must be configured manually with the following command:
```shell ```shell
mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions mkdir -p ~/.config/fish/completions; and ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions
``` ```
#### --Linux,ZSH,Git-- #### --Linux,ZSH,Git--
@ -235,10 +235,12 @@ echo -e "\nsource "(brew --prefix asdf)"/asdf.fish" >> ~/.config/fish/config.fis
Add `asdf.sh` to your `~/.zshrc` with: Add `asdf.sh` to your `~/.zshrc` with:
```shell ```shell
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
``` ```
**OR** use a ZSH Framework plugin like [asdf for oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/asdf) which will source this script and setup completions.
?> Completions are configured by either a ZSH Framework `asdf` or will need to be [configured as per Homebrew's instructions](https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh). If you are using a ZSH Framework the associated asdf plugin may need to be updated to use the new ZSH completions properly via fpath. The Oh-My-ZSH asdf plugin is yet to be updated, see [ohmyzsh/ohmyzsh#8837](https://github.com/ohmyzsh/ohmyzsh/pull/8837).
?> Completions will need to be [configured as per Homebrew's instructions](https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh).
### --Docsify Select Default-- ### --Docsify Select Default--

View File

@ -84,6 +84,17 @@ The version format is the same supported by the `.tool-versions` file.
ASDF_ELIXIR_VERSION=1.4.0 mix test ASDF_ELIXIR_VERSION=1.4.0 mix test
``` ```
## Fallback to System Version
To use the system version of tool `<name>` instead of an asdf managed version you can set the version for the tool to `system`.
Set system with either `global`, `local` or `shell` as outlined in [Set Current Version](#set-current-version) section above.
```shell
asdf local <name> system
# asdf local python system
```
## View Current Version ## View Current Version
```shell ```shell
@ -122,6 +133,6 @@ source $(asdf which ${PLUGIN})/../script.sh
source $(asdf where ${PLUGIN} $(asdf current ${PLUGIN}))/bin/script.sh source $(asdf where ${PLUGIN} $(asdf current ${PLUGIN}))/bin/script.sh
``` ```
###### By-passing asdf shims. ### By-passing asdf shims
If for some reason you want to by-pass asdf shims or want your environment variables automatically set upon entering your project's directory, the [asdf-direnv](https://github.com/asdf-community/asdf-direnv) plugin can be helpful. Be sure to check its README for more details. If for some reason you want to by-pass asdf shims or want your environment variables automatically set upon entering your project's directory, the [asdf-direnv](https://github.com/asdf-community/asdf-direnv) plugin can be helpful. Be sure to check its README for more details.

View File

@ -217,7 +217,7 @@ asdf plugin test nodejs https://github.com/asdf-vm/asdf-nodejs.git node --versio
We strongly recommend you test your plugin on a CI environment and make sure it works on both Linux and OSX. We strongly recommend you test your plugin on a CI environment and make sure it works on both Linux and OSX.
#### Example Github Action #### Example GitHub Action
The [asdf-vm/actions](https://github.com/asdf-vm/actions) repo provides a GitHub Action for testing your plugins hosted on github. The [asdf-vm/actions](https://github.com/asdf-vm/actions) repo provides a GitHub Action for testing your plugins hosted on github.

View File

@ -7,9 +7,10 @@ asdf plugin list [--urls] [--refs] List installed plugins. Optionally show
asdf plugin list all List plugins registered on asdf-plugins asdf plugin list all List plugins registered on asdf-plugins
repository with URLs repository with URLs
asdf plugin remove <name> Remove plugin and package versions asdf plugin remove <name> Remove plugin and package versions
asdf plugin update <name> [<git-ref>] Update a plugin to latest commit or a asdf plugin update <name> [<git-ref>] Update a plugin to latest commit on
particular git-ref default branch or a particular git-ref
asdf plugin update --all Update all plugins asdf plugin update --all Update all plugins to latest commit on
default branch
MANAGE PACKAGES MANAGE PACKAGES
@ -51,3 +52,7 @@ asdf shim-versions <command> List the plugins and versions that
provide a command provide a command
asdf update Update asdf to the latest stable release asdf update Update asdf to the latest stable release
asdf update --head Update asdf to the latest on the master branch asdf update --head Update asdf to the latest on the master branch
RESOURCES
GitHub: https://github.com/asdf-vm/asdf
Docs: https://asdf-vm.com

View File

@ -14,7 +14,7 @@ list_command() {
display_installed_versions "$plugin_name" display_installed_versions "$plugin_name"
done done
else else
printf "%s\\n" 'Oohes nooes ~! No plugins installed' printf "%s\\n" 'No plugins installed'
fi fi
else else
check_if_plugin_exists "$plugin_name" check_if_plugin_exists "$plugin_name"

View File

@ -45,7 +45,7 @@ plugin_list_command() {
done done
) | awk '{ if (NF > 1) { printf("%-28s", $1) ; $1="" }; print $0}' ) | awk '{ if (NF > 1) { printf("%-28s", $1) ; $1="" }; print $0}'
else else
display_error 'Oohes nooes ~! No plugins installed' display_error 'No plugins installed'
exit 1 exit 1
fi fi
} }

View File

@ -13,7 +13,7 @@ with the format `<next-version>-dev`).
2. Run the tests and the linter - `bats test` and `lint.sh`. 2. Run the tests and the linter - `bats test` and `lint.sh`.
3. Run the release script. The new version must be in the format `0.0.0-rc0`. 3. Run the release script. The new version must be in the format `0.0.0-rc0`.
For example: `release/tag.sh 0.0.0-rc0`. For example: `release/tag.sh 0.0.0-rc0`.
4. If the release script succeeds, push to Github. Make sure to use the correct 4. If the release script succeeds, push to GitHub. Make sure to use the correct
remote to push to the official repository remote to push to the official repository
## Tagging Releases ## Tagging Releases
@ -24,5 +24,5 @@ with the format `<next-version>-dev`).
2. Run the tests and the linter - `bats test` and `lint.sh`. 2. Run the tests and the linter - `bats test` and `lint.sh`.
3. Run the release script. The new version must be in the format `0.0.0`. For 3. Run the release script. The new version must be in the format `0.0.0`. For
example: `release/tag.sh 0.0.0`. example: `release/tag.sh 0.0.0`.
4. If the release script succeeds, push to Github. Make sure to use the correct 4. If the release script succeeds, push to GitHub. Make sure to use the correct
remote to push to the official repository remote to push to the official repository

View File

@ -14,8 +14,9 @@ banned_commands=(
column column
# does not work on alpine and should be grep -i either way # does not work on alpine and should be grep -i either way
"grep.* -y" "grep.* -y"
# sort -V isn't supported everywhere # sort --sort-version isn't supported everywhere
"sort.*-V" "sort.*-V"
"sort.*--sort-versions"
# echo isn't consistent across operating systems, and sometimes output can # echo isn't consistent across operating systems, and sometimes output can
# be confused with echo flags. printf does everything echo does and more. # be confused with echo flags. printf does everything echo does and more.
echo echo

2
test/current_command.bats Normal file → Executable file
View File

@ -127,7 +127,7 @@ foobar 1.0.0 $PROJECT_DIR/.tool-versions"
@test "with no plugins prints an error" { @test "with no plugins prints an error" {
clean_asdf_dir clean_asdf_dir
expected="Oohes nooes ~! No plugins installed" expected="No plugins installed"
run asdf current run asdf current
[ "$status" -eq 0 ] [ "$status" -eq 0 ]

View File

@ -3,32 +3,81 @@
load test_helpers load test_helpers
setup() { setup() {
BASE_DIR=$(mktemp -dt asdf.XXXX) setup_asdf_dir
HOME=$BASE_DIR/home install_mock_plugin_repo "dummy"
ASDF_DIR=$HOME/.asdf run asdf plugin-add "dummy" "${BASE_DIR}/repo-dummy"
git clone -o local "$(dirname "$BATS_TEST_DIRNAME")" "$ASDF_DIR"
git --git-dir "$ASDF_DIR/.git" remote add origin https://github.com/asdf-vm/asdf.git
mkdir -p "$ASDF_DIR/plugins"
ASDF_BIN="$ASDF_DIR/bin"
# shellcheck disable=SC2031
PATH=$ASDF_BIN:$ASDF_DIR/shims:$PATH
install_dummy_plugin
PROJECT_DIR=$HOME/project
mkdir $PROJECT_DIR
} }
teardown() { teardown() {
clean_asdf_dir clean_asdf_dir
} }
@test "asdf plugin-update should pull latest master branch for plugin" { @test "asdf plugin-update should pull latest default branch (refs/remotes/origin/HEAD) for plugin" {
run asdf plugin-update dummy run asdf plugin-update dummy
repo_head="$(git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" rev-parse --abbrev-ref HEAD)"
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ "$output" =~ "Updating dummy..."* ]] [[ "$output" =~ "Updating dummy to master"* ]]
cd $ASDF_DIR/plugins/dummy [ "$repo_head" = "master" ]
[ $(git rev-parse --abbrev-ref HEAD) = "master" ] }
@test "asdf plugin-update should pull latest default branch (refs/remotes/origin/HEAD) for plugin even if default branch changes" {
install_mock_plugin_repo "dummy-remote"
remote_dir="$BASE_DIR/repo-dummy-remote"
# set HEAD to refs/head/main in dummy-remote
git -C "${remote_dir}" checkout -b main
# track & fetch remote repo (dummy-remote) in plugin (dummy)
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote remove origin
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote add origin "$remote_dir"
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" fetch origin
run asdf plugin-update dummy
repo_head="$(git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" rev-parse --abbrev-ref HEAD)"
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating dummy to main"* ]]
[ "$repo_head" = "main" ]
}
@test "asdf plugin-update should pull latest default branch (refs/remotes/origin/HEAD) for plugin even if the default branch contains a forward slash" {
install_mock_plugin_repo "dummy-remote"
remote_dir="$BASE_DIR/repo-dummy-remote"
# set HEAD to refs/head/my/default in dummy-remote
git -C "${remote_dir}" checkout -b my/default
# track & fetch remote repo (dummy-remote) in plugin (dummy)
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote remove origin
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote add origin "$remote_dir"
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" fetch origin
run asdf plugin-update dummy
repo_head="$(git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" rev-parse --abbrev-ref HEAD)"
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating dummy to my/default"* ]]
[ "$repo_head" = "my/default" ]
}
@test "asdf plugin-update should pull latest default branch (refs/remotes/origin/HEAD) for plugin even if already set to specific ref" {
# set plugin to specific sha
current_sha="$(git --git-dir "${BASE_DIR}/repo-dummy/.git" --work-tree "$BASE_DIR/repo-dummy" rev-parse HEAD)"
run asdf plugin-update dummy "${current_sha}"
# setup mock plugin remote
install_mock_plugin_repo "dummy-remote"
remote_dir="$BASE_DIR/repo-dummy-remote"
# set HEAD to refs/head/main in dummy-remote
git -C "${remote_dir}" checkout -b main
# track & fetch remote repo (dummy-remote) in plugin (dummy)
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote remove origin
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" remote add origin "$remote_dir"
git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" fetch origin
# update plugin to the default branch
run asdf plugin-update dummy
repo_head="$(git --git-dir "$ASDF_DIR/plugins/dummy/.git" --work-tree "$ASDF_DIR/plugins/dummy" rev-parse --abbrev-ref HEAD)"
[ "$status" -eq 0 ]
[[ "$output" =~ "Updating dummy to main"* ]]
[ "$repo_head" = "main" ]
} }
@test "asdf plugin-update should not remove plugin versions" { @test "asdf plugin-update should not remove plugin versions" {

View File

@ -436,3 +436,15 @@ EOM
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
} }
# From @tejanium in https://github.com/asdf-vm/asdf/issues/581#issuecomment-635337727
@test "asdf exec should not crash when POSIXLY_CORRECT=1" {
export POSIXLY_CORRECT=1
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
run asdf install
run asdf exec dummy world hello
echo $output
[ "$output" == "This is Dummy 1.0! hello world" ]
[ "$status" -eq 0 ]
}

View File

@ -41,7 +41,7 @@ install_mock_plugin_repo() {
git -C "${location}" config user.name "Test" git -C "${location}" config user.name "Test"
git -C "${location}" config user.email "test@example.com" git -C "${location}" config user.email "test@example.com"
git -C "${location}" add -A git -C "${location}" add -A
git -C "${location}" commit -q -m 'asdf dummy plugin' git -C "${location}" commit -q -m "asdf ${plugin_name} plugin"
} }
install_mock_plugin_version() { install_mock_plugin_version() {