diff --git a/.commit-check.yml b/.commit-check.yml index 9b0c3199..10f8d392 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -30,5 +30,5 @@ checks: - check: merge_base regex: main # it can be master, develop, devel etc based on your project. - error: Current branch is not up to date with target branch - suggest: please ensure your branch is rebased with the target branch + error: Current branch is not rebased onto target branch + suggest: Please ensure your branch is rebased with the target branch diff --git a/commit_check/__init__.py b/commit_check/__init__.py index 44d3c0d4..61de524f 100644 --- a/commit_check/__init__.py +++ b/commit_check/__init__.py @@ -51,8 +51,8 @@ { 'check': 'merge_base', 'regex': r'main', # it can be master, develop, devel etc based on your project. - 'error': 'Current branch is not up to date with target branch', - 'suggest': 'please ensure your branch is rebased with the target branch', + 'error': 'Current branch is not rebased onto target branch', + 'suggest': 'Please ensure your branch is rebased with the target branch', }, ], } diff --git a/commit_check/branch.py b/commit_check/branch.py index 2e235986..39bc7ecd 100644 --- a/commit_check/branch.py +++ b/commit_check/branch.py @@ -40,8 +40,9 @@ def check_merge_base(checks: list) -> int: f"{YELLOW}Not found target branch for checking merge base. skip checking.{RESET_COLOR}", ) return PASS + target_branch = check['regex'] if "origin/" in check['regex'] else f"origin/{check['regex']}" current_branch = get_branch_name() - result = git_merge_base(check['regex'], current_branch) + result = git_merge_base(target_branch, current_branch) if result != 0: if not print_error_header.has_been_called: print_error_header() diff --git a/commit_check/main.py b/commit_check/main.py index 3a2e6f3f..50b23508 100644 --- a/commit_check/main.py +++ b/commit_check/main.py @@ -79,7 +79,7 @@ def get_parser() -> argparse.ArgumentParser: parser.add_argument( '-mb', '--merge-base', - help='check common ancestors', + help='check branch is rebased onto target branch', action="store_true", required=False, )