Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
035c856c
Unverified
Commit
035c856c
authored
Jan 13, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: get branch name first in `omz version` and changelog
parent
805427e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
cli.zsh
lib/cli.zsh
+4
-3
changelog.sh
tools/changelog.sh
+3
-3
No files found.
lib/cli.zsh
View file @
035c856c
...
@@ -791,12 +791,13 @@ function _omz::version {
...
@@ -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
)
...
...
tools/changelog.sh
View file @
035c856c
...
@@ -395,12 +395,12 @@ function main {
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment