Skip to content

Ensure proper footer sorting of footer #256

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
Mar 12, 2025

Conversation

charliechiou
Copy link
Contributor

When no trailer was configured in git configuration, TRAILERS_BY_REGEX remained empty. This caused the subsequent match condition to always evaluate to true, leading to incorrect footer sorting regardless of their content.

To address this issue, the update ensures that when the configuration is empty, default terms are used to initialize TRAILERS_BY_REGEX. The sorting mechanism is then adjusted to prioritize other footers, configured trailers, and the change-id.

Change-Id: I6df5438b7ec6c85f5438f869b44cd14589c03339

@charliechiou charliechiou force-pushed the fix-git-hook branch 2 times, most recently from 4ad8e16 to 232546a Compare March 11, 2025 17:49
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always squash commits for a single purpose pull request.

When no trailer was configured in git configuration, TRAILERS_BY_REGEX
remained empty. This caused the subsequent match condition to always
evaluate to true, leading to incorrect footer sorting regardless of
their content. To address this issue, the update ensures that when the
configuration is empty, default terms are used to initialize
TRAILERS_BY_REGEX. The sorting mechanism is then adjusted to prioritize
other footers, configured trailers, and the change-id.

Co-authored-by: EricccTaiwan <[email protected]>
Change-Id: I6df5438b7ec6c85f5438f869b44cd14589c03339

Refactor commit trailer regex

Refactor commit trailer regex by renaming default_trailers_by to
DEFAULT_TRAILERS_BY to follow the naming convention for global
variables.Then refine build_commit_trailer_regex by reusing the array.

Co-authored-by: EricccTaiwan <[email protected]>
Change-Id: I7c7e9367f59a6da0ff84605904d08343ad558f42
@jserv jserv merged commit 43a311d into sysprog21:master Mar 12, 2025
1 of 2 checks passed
@jserv
Copy link
Contributor

jserv commented Mar 12, 2025

Thank @charliechiou for contributing!

@charliechiou charliechiou deleted the fix-git-hook branch March 12, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants