Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Fixing edge case for patch version of 0 (#3063)
Browse files Browse the repository at this point in the history
When the array splitting happen there are cases where the patch
(maj.min.patch) is 0. Using ++ to increment that 0 causes a
return code of 1. Using +=1 instead increments the value but has
a return code of 0.
  • Loading branch information
mattfarina authored and k8s-ci-robot committed Dec 17, 2017
1 parent 44d306e commit 7cbb848
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/semvercompare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ semvercompare() {
# No pre-release was found so we increment the patch version and attach a
# -0 to enable pre-releases being found.
local ov=( ${semvercompareOldVer//./ } ) # Turn the version into an array
((ov[2]++)) # Increment the patch release
((ov[2]+=1)) # Increment the patch release
out=$(vert ">${ov[0]}.${ov[1]}.${ov[2]}-0" $semvercompareNewVer)
ret=$?
fi
Expand Down

0 comments on commit 7cbb848

Please sign in to comment.