Skip to content

fix: check target branch name and update help #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions commit_check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
}
Expand Down
3 changes: 2 additions & 1 deletion commit_check/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion commit_check/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
Loading
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