From 11e7e77db0f92864a3e203e5e824c4d5f6de5f77 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Fri, 22 Jul 2022 15:02:30 -0400 Subject: ez: bail on unknown cover letter strategy We currently only support "commit" and "branch-description" strategies. Two more may be implemented in the future, but I need to figure out if commit reordering can be done with git-filter-repo or not. Signed-off-by: Konstantin Ryabitsev --- b4/ez.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/b4/ez.py b/b4/ez.py index 35bb622..3ffc4a3 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -348,6 +348,11 @@ def store_cover(content: str, tracking: dict, new: bool = False) -> None: logger.info('Updated branch description and tracking info.') +# Valid cover letter strategies: +# 'commit': in a commit at the start of the series : implemented +# 'branch-description': in the branch description : implemented +# 'tip-commit': in a commit at the tip of the branch : TODO +# 'tag': in an annotated tag at the tip of the branch : TODO def get_cover_strategy(branch: Optional[str] = None) -> str: if branch is None: branch = b4.git_get_current_branch() @@ -359,7 +364,11 @@ def get_cover_strategy(branch: Optional[str] = None) -> str: config = b4.get_main_config() strategy = config.get('ez-cover-strategy', 'commit') - return strategy + if strategy in {'commit', 'branch-description'}: + return strategy + + logger.critical('CRITICAL: unknown ez-cover-strategy: %s', strategy) + sys.exit(1) def is_ez_branch() -> bool: -- cgit v1.2.3