Skip to content

Commit

Permalink
Fix a few bugs present in no-tags-present scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickolas Means committed May 26, 2011
1 parent 79d1a15 commit bba9408
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gitflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }
git_all_tags() { git tag; }

git_all_tags_by_date() { git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags; }
git_all_tags_by_date() { git for-each-ref --sort='*authordate' --format='%(refname:short)' refs/tags; }

git_current_branch() {
git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'
Expand Down Expand Up @@ -321,7 +321,7 @@ require_branches_equal() {
#

git_current_version() {
echo "$(git_all_tags_by_date)" | grep -e '.*[0-9]*\.[0-9]*\.[0-9].*' | sed '$!d' | sed -n 's/[^0-9]*\([0-9]*.[0-9]*.[0-9]\)/\1/p'
echo "$(git_all_tags_by_date)" | grep -e '.*[0-9]*\.[0-9]*\.[0-9].*' | sed '$!d' | sed -n 's/[^0-9]*\([0-9]*.[0-9]*.[0-9]\)[^0-9]*/\1/p'
}

git_current_major_version() {
Expand All @@ -337,7 +337,7 @@ git_current_revision_version() {
}

git_next_major_version() {
if [ $(git_current_version) == ""]; then
if [ -z $(git_current_version) ]; then
echo "1.0.0"
else
maj=$( echo "$(git_current_major_version)" | awk '{ print $1 + 1 }' )
Expand All @@ -348,7 +348,7 @@ git_next_major_version() {
}

git_next_minor_version() {
if [ $(git_current_version) == ""]; then
if [ -z $(git_current_version) ]; then
echo "1.0.0"
else
maj=$(git_current_major_version)
Expand All @@ -359,7 +359,7 @@ git_next_minor_version() {
}

git_next_revision_version() {
if [ $(git_current_version) == "" ]; then
if [ -z $(git_current_version) ]; then
echo "1.0.0"
else
maj=$(git_current_major_version)
Expand Down

0 comments on commit bba9408

Please sign in to comment.