From a7c6a67758eb5da56bc6bd48c5f08e80aa560cd2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 12 Nov 2024 19:57:00 +0200 Subject: [PATCH] fix: check target branch name and update help --- .commit-check.yml | 4 ++-- commit_check/__init__.py | 4 ++-- commit_check/branch.py | 3 ++- commit_check/main.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.commit-check.yml b/.commit-check.yml index 9b0c319..10f8d39 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 44d3c0d..61de524 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 2e23598..39bc7ec 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 3a2e6f3..50b2350 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, ) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy