Implement `git commit --trailer` and refactor trailer code
This is an alternative proposal to #13 (closed).
As was mentioned on the mailing list, they don't want to blindly add Yet Another Command Line Option™, but they want something more generic first.
As an initial step they'd like to have a git commit --trailer command line option, before ever adding git commit --co-authored-by.
Proposal
At the moment the files trailer.{c,h} exists. They generalize commit trailers a bit. But they are only used by git interpret-trailers. That command is quite specific and mostly operates on file. So for those reasons the code there is not easily reused by git commit. Therefore I'd like to refactor that code, and possibly move more to trailer.{c,h}. When the code is more generic it should be possible to use it by both git commands, and possibly more.
git commit --signed-off will also have to be rewritten so it uses proper trailers instead of something specific.
Then also git commit --trailer can be added.
By using trailer.{c,h} adding trailers should be more robust and also deduplication should work. Commits with trailers like the following should be in the past:
This is my commit
This is where I heal all my hurts.
Signed-off-by: Alice <alice@example.com>
Co-authored-by: Bob <bob@example.com>
Signed-off-by: Alice <alice@example.com>
So trailer parsing will also take place when --amending a commit and such.