Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/commitlint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
r"^Merge remote-tracking branch(\s*)(.*)$|"
r"^Automatic merge(.*)$|"
r"^Auto-merged (.*?) into (.*)$|"
r"[Bb]ump [^\s]+ from [^\s]+ to [^\s]+"
r"[Bb]ump [^\s]+ from [^\s]+ to [^\s]+|"
r"^[Ii]nitial [Cc]ommit$"
)
2 changes: 2 additions & 0 deletions src/commitlint/git_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_commit_message_of_hash(commit_hash: str) -> str:
stderr=subprocess.PIPE,
).strip()
console.verbose(commit_message)
console.verbose("execute complete")

return commit_message
except subprocess.CalledProcessError as ex:
Expand Down Expand Up @@ -91,6 +92,7 @@ def get_commit_messages_of_hash_range(
stderr=subprocess.PIPE,
)
console.verbose(commit_messages_output)
console.verbose("execute complete")

commit_messages = commit_messages_output.split(f"{delimiter}\n")
return [from_commit_message] + [
Expand Down
3 changes: 2 additions & 1 deletion src/commitlint/linter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def is_ignored(commit_message: str) -> bool:
Returns:
bool: True if the commit message should be ignored, False otherwise.
"""
return bool(re.match(IGNORE_COMMIT_PATTERNS, commit_message))
commit_first_line = commit_message.splitlines()[0]
return bool(re.match(IGNORE_COMMIT_PATTERNS, commit_first_line))


def remove_comments(commit_message: str) -> str:
Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
("feat!: breaking feature", True, []),
# ignored commits (success)
("Merge pull request #123", True, []),
(
"Merge branch 'main' into release\nthis is second line",
True,
[],
),
("Bump urllib3 from 1.26.5 to 1.26.17", True, []),
("Bump github.com/ollama/ollama from 0.1.48 to 0.2.0", True, []),
("bump @babel/traverse from 7.22.17 to 7.24.0", True, []),
Expand All @@ -55,6 +60,8 @@
True,
[],
),
("Initial commit", True, []),
("initial Commit", True, []),
# incorrect format check
("feat add new feature", False, [INCORRECT_FORMAT_ERROR]),
# header length check
Expand Down