Tried the following from your docs to upgrade nvm manually
(
cd "$NVM_DIR"
git fetch origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && \. "$NVM_DIR/nvm.sh"
but that prints me a git error:
┌─( /Users/michael-heuberger/.nvm 7ad6d98
cd "$NVM_DIR"
git fetch origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && \. "$NVM_DIR/nvm.sh"
CONTRIBUTING.md LICENSE.md README.md alias bin nvm-exec package.json update_test_mocks.sh
Dockerfile Makefile ROADMAP.md bash_completion install.sh nvm.sh test versions
fatal: Not a valid object name origin
Hmm - what does git remote print out inside $NVM_DIR? Note that nvm must have been initially installed using git (ie, git was available when install.sh was ran) for this to work.
$ git remote
prints just
origin
Dont remember how I installed nvm so cant answer that.
What is git --version?
2.17.0
added second system experiencing the same issues
Seeing the exact same behavior as @binarykitchen on my systems
git 2.11.0nvm 0.33.8git 1.8.3.1nvm 0.33.8And in the git repo (on all three systems described above), what does git describe origin print out?
can't test my debian system until i'm home, but the centos system prints out the same error:
[USER@HOSTNAME .nvm]$ git describe origin
fatal: Not a valid object name origin
same here
└─( 2 ) ❱❱❱ git describe origin
fatal: Not a valid object name origin
That's very confusing. If you git fetch first and then git describe origin, the same thing happens?
centos system, straight from the terminal
[USER@HOSTNAME .nvm]$ git status
# Not currently on any branch.
nothing to commit, working directory clean
[USER@HOSTNAME .nvm]$ git fetch
[USER@HOSTNAME .nvm]$ git describe origin
fatal: Not a valid object name origin
Ok, next try :-) git fetch --unshallow before the describe?
coming right up
[USER@HOSTNAME .nvm]$ git fetch --unshallow
remote: Counting objects: 6396, done.
remote: Compressing objects: 100% (2410/2410), done.
remote: Total 6396 (delta 4191), reused 6156 (delta 3951), pack-reused 0
Receiving objects: 100% (6396/6396), 1.88 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4191/4191), completed with 173 local objects.
[USER@HOSTNAME .nvm]$ git describe origin
fatal: Not a valid object name origin
Well crap, i thought that might do it.
I’m still not sure what’s going on; I’ll think more on it.
I guess this may be a wrong usage, man page of git-describe didn't describe any usage with "remote" name
Usage like out Makefile is correct:
https://github.com/creationix/nvm/blob/master/Makefile#L74
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
@binarykitchen @joshsleeper would you like to try the revised version here? Hope it'll work for you!
https://github.com/creationix/nvm/pull/1786
Argh...
So I was _pretty_ sure #1786 fixed things, but here I am on 0.33.9 and the new upgrade script doesn't bump me to 0.33.11 (latest at time of writing)
So maybe it's not quite resolved?
You might need a git fetch as well, beforehand?
yes, works now
nope, on git 1.8.3.1 running git fetch beforehand changes nothing.
also, the current upgrade script already does git fetch anyway.
it _appears_ to be that git fetch in my context doesn't actually pull down tags, so it always thinks it's at the latest version?
some insight: https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch
through some testing on my own box (completely remove .nvm, reinstall 0.33.9 fresh, run manual upgrade script with custom git fetch) it appears I've got something that works.
(
cd "$NVM_DIR"
git fetch --tags origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"
the key detail being the --tags flag to git fetch.
given the way that nvm is currently tagged, it seems that simply adding --tags is sufficient to get older git to detect the updated tag list, and thus allow upgrades.
submitting a pr shortly, but feel free to contend it if I'm wrong!