FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: check target branch name and update help (#194) · commit-check/commit-check@3ec5112 · GitHub

Commit 3ec5112

Browse files
authored
fix: check target branch name and update help (#194)
1 parent 62a74a3 commit 3ec5112

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎.commit-check.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ checks:
3030

3131
- check: merge_base
3232
regex: main # it can be master, develop, devel etc based on your project.
33-
error: Current branch is not up to date with target branch
34-
suggest: please ensure your branch is rebased with the target branch
33+
error: Current branch is not rebased onto target branch
34+
suggest: Please ensure your branch is rebased with the target branch

‎commit_check/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
{
5252
'check': 'merge_base',
5353
'regex': r'main', # it can be master, develop, devel etc based on your project.
54-
'error': 'Current branch is not up to date with target branch',
55-
'suggest': 'please ensure your branch is rebased with the target branch',
54+
'error': 'Current branch is not rebased onto target branch',
55+
'suggest': 'Please ensure your branch is rebased with the target branch',
5656
},
5757
],
5858
}

‎commit_check/branch.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ def check_merge_base(checks: list) -> int:
4040
f"{YELLOW}Not found target branch for checking merge base. skip checking.{RESET_COLOR}",
4141
)
4242
return PASS
43+
target_branch = check['regex'] if "origin/" in check['regex'] else f"origin/{check['regex']}"
4344
current_branch = get_branch_name()
44-
result = git_merge_base(check['regex'], current_branch)
45+
result = git_merge_base(target_branch, current_branch)
4546
if result != 0:
4647
if not print_error_header.has_been_called:
4748
print_error_header()

‎commit_check/main.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_parser() -> argparse.ArgumentParser:
7979
parser.add_argument(
8080
'-mb',
8181
'--merge-base',
82-
help='check common ancestors',
82+
help='check branch is rebased onto target branch',
8383
action="store_true",
8484
required=False,
8585
)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL