mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-22 20:03:38 +00:00
1a0be6f0ad
It doesn't try to chdir into RBENV_ROOT anymore because that might be a location of an unrelated rbenv install that might have a different version than the current one that is installed e.g. via a package manager such as Homebrew. Now just tries the repo where the source files (`libexec/*`) are located, and if that isn't a valid rbenv repo, bail out early.
23 lines
632 B
Bash
Executable file
23 lines
632 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Summary: Display the version of rbenv
|
|
#
|
|
# Displays the version number of this rbenv release, including the
|
|
# current revision from git, if available.
|
|
#
|
|
# The format of the git revision is:
|
|
# <version>-<num_commits>-<git_sha>
|
|
# where `num_commits` is the number of commits since `version` was
|
|
# tagged.
|
|
|
|
set -e
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
|
|
|
version="0.4.0"
|
|
git_revision=""
|
|
|
|
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q rbenv; then
|
|
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
|
|
git_revision="${git_revision#v}"
|
|
fi
|
|
|
|
echo "rbenv ${git_revision:-$version}"
|