mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
fix: get branch name first in omz version
and changelog
This commit is contained in:
parent
805427e06b
commit
035c856c2c
2 changed files with 7 additions and 6 deletions
|
@ -791,12 +791,13 @@ function _omz::version {
|
||||||
|
|
||||||
# Get the version name:
|
# Get the version name:
|
||||||
# 1) try tag-like version
|
# 1) try tag-like version
|
||||||
# 2) try name-rev
|
# 2) try branch name
|
||||||
# 3) try branch name
|
# 3) try name-rev (tag~<rev> or branch~<rev>)
|
||||||
local version
|
local version
|
||||||
version=$(command git describe --tags HEAD 2>/dev/null) \
|
version=$(command git describe --tags HEAD 2>/dev/null) \
|
||||||
|
|| version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null) \
|
||||||
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \
|
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \
|
||||||
|| version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null)
|
|| version="<detached>"
|
||||||
|
|
||||||
# Get short hash for the current HEAD
|
# Get short hash for the current HEAD
|
||||||
local commit=$(command git rev-parse --short HEAD 2>/dev/null)
|
local commit=$(command git rev-parse --short HEAD 2>/dev/null)
|
||||||
|
|
|
@ -395,12 +395,12 @@ function main {
|
||||||
|
|
||||||
# Get the first version name:
|
# Get the first version name:
|
||||||
# 1) try tag-like version, or
|
# 1) try tag-like version, or
|
||||||
# 2) try name-rev, or
|
# 2) try branch name, or
|
||||||
# 3) try branch name, or
|
# 3) try name-rev, or
|
||||||
# 4) try short hash
|
# 4) try short hash
|
||||||
version=$(command git describe --tags $until 2>/dev/null) \
|
version=$(command git describe --tags $until 2>/dev/null) \
|
||||||
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" $until 2>/dev/null) \
|
|
||||||
|| version=$(command git symbolic-ref --quiet --short $until 2>/dev/null) \
|
|| version=$(command git symbolic-ref --quiet --short $until 2>/dev/null) \
|
||||||
|
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" $until 2>/dev/null) \
|
||||||
|| version=$(command git rev-parse --short $until 2>/dev/null)
|
|| version=$(command git rev-parse --short $until 2>/dev/null)
|
||||||
|
|
||||||
# Get commit list from $until commit until $since commit, or until root commit if $since is unset
|
# Get commit list from $until commit until $since commit, or until root commit if $since is unset
|
||||||
|
|
Loading…
Reference in a new issue