From 87a3a4425d68fb11ad1e37c60ef64b21e1dddba8 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 28 Jul 2016 09:10:14 -0700 Subject: [PATCH] Ensure `git describe` only matches version tags `git describe` will match the latest tags, regardless of what it looks like. We can make this a little safer by adding a `--match` flag to match tags that look like version tags. This allows the maintainers of this repo to more safely add other types of tags if they so wish, without causing people to install or upgrade to those versions. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index b6891e4..165fbf1 100644 --- a/README.markdown +++ b/README.markdown @@ -84,7 +84,7 @@ For manual install create a folder somewhere in your filesystem with the `nvm.sh Or if you have `git` installed, then just clone it, and check out the latest version: ```sh -git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags origin` +git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` ``` To activate nvm, you need to source it from your shell: @@ -106,7 +106,7 @@ export NVM_DIR="$HOME/.nvm" For manual upgrade with `git`, change to the `$NVM_DIR`, pull down the latest changes, and check out the latest version: ```sh -cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags origin` +cd "$NVM_DIR" && git fetch origin && git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` ``` After upgrading, don't forget to activate the new version: