diff --git a/CHANGELOG.md b/CHANGELOG.md index 5722be777..e846b6f4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * `new-component` command was moved to the `component` command group ([#122]) * Jsonnet library file extension to `.libsonnet` in component template ([#137]) +### Fixed + +* Commit messages from automated catalog updates do no longer contain a leading newline ([#136]) + ## [v0.1.6] ### Changed @@ -106,4 +110,5 @@ Initial implementation [#130]: https://github.com/projectsyn/commodore/pull/130 [#133]: https://github.com/projectsyn/commodore/pull/133 [#134]: https://github.com/projectsyn/commodore/pull/134 +[#136]: https://github.com/projectsyn/commodore/issues/136 [#137]: https://github.com/projectsyn/commodore/pull/137 diff --git a/commodore/catalog.py b/commodore/catalog.py index 30dc6392d..ff388c54a 100644 --- a/commodore/catalog.py +++ b/commodore/catalog.py @@ -38,8 +38,7 @@ def _render_catalog_commit_msg(cfg): config_commits = [_pretty_print_config_commit(c, r) for c, r in cfg.get_configs().items()] config_commits = '\n'.join(config_commits) - return f""" -Automated catalog update from Commodore + return f"""Automated catalog update from Commodore Component commits: {component_commits} diff --git a/tests/test_catalog.py b/tests/test_catalog.py new file mode 100644 index 000000000..086b888ba --- /dev/null +++ b/tests/test_catalog.py @@ -0,0 +1,14 @@ +""" +Tests for catalog internals +""" + +from commodore.catalog import _render_catalog_commit_msg +from commodore.config import Config + + +def test_catalog_commit_message(): + config = Config("https://syn.example.com", "token", "ssh://git@git.example.com", False) + + commit_message = _render_catalog_commit_msg(config) + assert not commit_message.startswith('\n') + assert commit_message.startswith('Automated catalog update from Commodore\n\n')