Skip to main content

Module commit_trailers

Module commit_trailers 

Source
Expand description

Cherry-pick / sign-off trailer handling compatible with Git’s sequencer.c and trailer.c.

Used when rewriting commit messages for cherry-pick -x / -s so spacing and trailer detection match upstream tests (e.g. t3511-cherry-pick-x).

Structs§

TrailerOpts
Options parsed from a %(trailers:...) pretty placeholder, mirroring Git’s process_trailer_options in pretty.c / trailer.c.

Functions§

append_cherry_picked_from_line
Append -x trailer matching sequencer.c (record_origin).
append_signoff_trailer
Append sign-off matching append_signoff in sequencer.c (no APPEND_SIGNOFF_DEDUP).
append_signoff_trailer_with_dedup
Append sign-off with optional APPEND_SIGNOFF_DEDUP (set by format-patch --signoff, which suppresses adding a sign-off that already exists anywhere in the trailer block, not just at the very end).
finalize_cherry_pick_message
Apply -x / -s rewriting plus optional commit.cleanup when -x is set.
format_signoff_line
Build Signed-off-by: Name <email>\n using the same identity resolution as cherry-pick.
format_trailers
Format the trailers of msg according to opts, matching Git’s format_trailers_from_commit used by the %(trailers:...) pretty placeholder.
message_ends_with_trailer
Whether the final non-blank line of msg looks like a trailer (per trailer.c rules from config). Used to decide whether an appended Signed-off-by: joins the existing trailer block (single \n) or starts a new paragraph (\n\n), matching Git’s append_signoff.