mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
fix(versioning/cargo): bump simple versions to newVersion (#28632)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
parent
1eabe3896c
commit
e11badfe4c
2 changed files with 11 additions and 7 deletions
|
@ -125,13 +125,13 @@ describe('modules/versioning/cargo/index', () => {
|
|||
${'1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'2.0.0'}
|
||||
${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2.1.7'}
|
||||
${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'}
|
||||
${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5'}
|
||||
${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5.1'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6.1'}
|
||||
${'0.5'} | ${'bump'} | ${'0.5.0'} | ${'0.5.1'} | ${'0.5'}
|
||||
${'0.5'} | ${'bump'} | ${'0.5.0'} | ${'0.6.1'} | ${'0.6'}
|
||||
${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5.1.7'}
|
||||
${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6.1.7'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0.7'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5.1.7'}
|
||||
${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6.1.7'}
|
||||
${'0.5'} | ${'bump'} | ${'0.5.0'} | ${'0.5.1'} | ${'0.5.1'}
|
||||
${'0.5'} | ${'bump'} | ${'0.5.0'} | ${'0.6.1'} | ${'0.6.1'}
|
||||
${'5.0'} | ${'replace'} | ${'5.0.0'} | ${'5.1.7'} | ${'5.0'}
|
||||
${'5.0'} | ${'replace'} | ${'5.0.0'} | ${'6.1.7'} | ${'6.0'}
|
||||
${'0.5'} | ${'replace'} | ${'0.5.0'} | ${'0.6.1'} | ${'0.6'}
|
||||
|
|
|
@ -94,6 +94,10 @@ function getNewValue({
|
|||
if (!currentValue || currentValue === '*') {
|
||||
return rangeStrategy === 'pin' ? `=${newVersion}` : currentValue;
|
||||
}
|
||||
// If the current value is a simple version, bump to fully specified newVersion
|
||||
if (rangeStrategy === 'bump' && regEx(/^\d+(?:\.\d+)*$/).test(currentValue)) {
|
||||
return newVersion;
|
||||
}
|
||||
if (rangeStrategy === 'pin' || isSingleVersion(currentValue)) {
|
||||
let res = '=';
|
||||
if (currentValue.startsWith('= ')) {
|
||||
|
|
Loading…
Reference in a new issue