From 6495f8134421102279c670cff5a95a43e86b55cd Mon Sep 17 00:00:00 2001 From: Manuel Hutter Date: Wed, 8 Jul 2020 16:35:10 +0200 Subject: [PATCH 1/2] Remove leading newline from commit messages Fixes #136 Signed-off-by: Manuel Hutter --- CHANGELOG.md | 5 +++++ commodore/catalog.py | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) 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} From 9e7c44ea0ec6e845046e7ff32ef32d5affe8b6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20R=C3=BCegg?= Date: Thu, 9 Jul 2020 09:13:19 +0200 Subject: [PATCH 2/2] Write test for commit message --- tests/test_catalog.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/test_catalog.py 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')