Skip to content

Fix placement of Git trailers (e.g. Co-authored-by) in commit message #294

Description

@Malix-Labs

Feature / Bug Description

Currently, update-flake-lock constructs the Git commit message by taking INPUT_COMMIT-MSG and appending the generated Nix update summary (Flake lock file updates:\n\n...) below it:

<INPUT_COMMIT-MSG>

Flake lock file updates:
• Updated input '...':

If commit-msg contains Git trailers (such as Co-authored-by: Name <email@domain.com>), update-flake-lock places Co-authored-by: above the Flake lock file updates: text block.

According to Git trailer specification (RFC 822 / Git commit conventions), Git trailers must be located at the very end of the commit message body (after the last paragraph). Because Flake lock file updates: is appended below Co-authored-by:, Git and GitHub do not recognize Co-authored-by: as a valid trailer, which breaks co-author attribution and commit verification rendering on GitHub.

Expected Behavior

Either:

  1. Git trailers (such as Co-authored-by:) placed in commit-msg should be placed at the very end of the commit body (after the Flake lock file updates: block), or
  2. An explicit commit-trailers input parameter is provided so trailers can be placed at the bottom of the generated commit message.

Related

Implementation

Those might be of use:

  • git interpret-trailers
  • git log --format="%(trailers)"
  • git commit --trailer "Co-authored-by: ..."

And again, on this note, this would be way simpler and less error prone if Git had such attributes to be native data for commits objects instead of relying on unstructured strings inside of commit messages.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions