mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Fix "full tag" match pattern
This commit is contained in:
parent
d061f3fb0e
commit
ed818a75eb
3 changed files with 17 additions and 2 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
|
|
@ -1139,7 +1139,7 @@ async function run() {
|
|||
branch = (await cmd('git', 'rev-parse', 'HEAD')).trim();
|
||||
}
|
||||
|
||||
const versionPattern = shortTags ? '*[0-9.]' : '[0-9]+\\.[0-9]+\\.[0-9]+'
|
||||
const versionPattern = shortTags ? '*[0-9.]' : '*[0-9].*[0-9].*[0-9]'
|
||||
const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`;
|
||||
let major = 0, minor = 0, patch = 0, increment = 0;
|
||||
let changed = true;
|
||||
|
|
|
|||
2
index.js
2
index.js
|
|
@ -118,7 +118,7 @@ async function run() {
|
|||
branch = (await cmd('git', 'rev-parse', 'HEAD')).trim();
|
||||
}
|
||||
|
||||
const versionPattern = shortTags ? '*[0-9.]' : '[0-9]+\\.[0-9]+\\.[0-9]+'
|
||||
const versionPattern = shortTags ? '*[0-9.]' : '*[0-9].*[0-9].*[0-9]'
|
||||
const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`;
|
||||
let major = 0, minor = 0, patch = 0, increment = 0;
|
||||
let changed = true;
|
||||
|
|
|
|||
|
|
@ -549,5 +549,20 @@ test('Regular expressions can be used as minor tag', () => {
|
|||
repo.makeCommit('Second Commit SomeValue'); // 0.0.1+1
|
||||
expect(repo.runAction()).toMatch('Version is 0.1.0+0');
|
||||
|
||||
repo.clean();
|
||||
});
|
||||
|
||||
test('Short tags disabled matches full tags', () => {
|
||||
const repo = createTestRepo({ short_tags: 'false' }); // 0.0.0
|
||||
|
||||
repo.makeCommit('Initial Commit');
|
||||
repo.makeCommit('Second Commit');
|
||||
repo.makeCommit('Third Commit');
|
||||
repo.exec('git tag v1.2.3');
|
||||
|
||||
const result = repo.runAction();
|
||||
|
||||
expect(result).toMatch('Version is 1.2.3+0');
|
||||
|
||||
repo.clean();
|
||||
});
|
||||
Loading…
Reference in a new issue