mirror of
https://github.com/drewcassidy/yaclog.git
synced 2024-09-01 14:58:58 +00:00
Fix tagging with spaces in version names
This commit is contained in:
parent
2bfaa78053
commit
b0419dad80
@ -210,7 +210,7 @@ class TestRelease(unittest.TestCase):
|
||||
runner.invoke(cli, ['init']) # create the changelog
|
||||
runner.invoke(cli, ['entry', '-b', 'entry number 1'])
|
||||
|
||||
result = runner.invoke(cli, ['release', '1.0.0', '-c'], input='y\n')
|
||||
result = runner.invoke(cli, ['release', 'Version 1.0.0', '-c'], input='y\n')
|
||||
check_result(self, result)
|
||||
self.assertIn('Created commit', result.output)
|
||||
self.assertIn('Created tag', result.output)
|
||||
|
@ -20,6 +20,7 @@ import os.path
|
||||
import click
|
||||
import git
|
||||
|
||||
import version
|
||||
import yaclog.version
|
||||
from yaclog.changelog import Changelog
|
||||
|
||||
@ -267,7 +268,11 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit):
|
||||
else:
|
||||
commit = repo.head.commit
|
||||
|
||||
repo_tag = repo.create_tag(cur_version.name, ref=commit, message=cur_version.body(False))
|
||||
short_version, *_ = version.extract_version(cur_version.name)
|
||||
if not short_version:
|
||||
short_version = cur_version.name.replace(' ', '-')
|
||||
|
||||
repo_tag = repo.create_tag(short_version, ref=commit, message=cur_version.body(False))
|
||||
click.echo(f"Created tag {click.style(repo_tag.name, fg='green')}.")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user