gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Commit trailer support

Open matthiasbeyer opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe.

A lot of projects require trailers, for example the Signed-off-by trailer.

Right now I do not see a way to make gitui commit with these trailers enabled.

Describe the solution you'd like

Trailers are in fact a complicated topic, because there are quite a few of them (it is a pseudo-standard) and they are structured data.

FWIW What I'd like to see would be a way to tell gitui to always add a Signed-off-by trailer with my name <email> as value, but also an option to add other trailers.

And here comes the problem. For example, a Co-authored-by trailer would be nice, but typing the value (some name and email address) is tedious. Especially if one has to do it all the time. What I could think of, though, would be this:

  • I open the editor to add a commit
  • I type my commit message
  • I hit some key combination for adding my signed-off-by (for example ctrl-s)
  • I hit another key combination for another trailer (for example ctrl-t)
  • I type coa to get the fuzzy completion for the Co-authored-by: trailer key
  • gitui provides a (fuzzy) selection-list that is filled from the authors in the git repository at hand (think git log --format="%an <%ae>" | sort -u | fzf). Then, I would type "BenB" and get fuzzy-completed the Benjamin Blümchen <[email protected]> author and hit Enter to confirm and gitui adds that trailer
  • I can repeat the above three points until satisfied

Because data for git-trailers can not necessarily be found from the git repository itself, I would even like to see some integration for running some external script for fetching the values for the interactive trailer-value selection!

Describe alternatives you've considered

The alternative I see right now is spawning the $EDITOR (in my case vim) which has been configured to provide these interactive completions for git trailers and type my commit message there.

matthiasbeyer avatar Nov 02 '22 07:11 matthiasbeyer

Can you point me to how other UI tools for git handle this? This is yet again a crazy complex feature in never used in git :D

extrawurst avatar Nov 02 '22 14:11 extrawurst

To be honest, gitui is my first attempt in using something that is not native git, apart maybe from vim-fugitive (vim plugin for git). FWIW I think tig does not support this, but I may be mistaken. GUI Tools like IntelliJ have a special knob in their commit interface to enable the signed off by line for a single commit. For other trailers, I don't know!

More rationale Thing is, that the `Signed-off-by` trailer is mission critical for a _lot_ of open source projects. Commits _have_ to be signed off in almost all open source projects I contribute to, because of the [developers certificate](https://developercertificate.org/) (some [rationale](https://drewdevault.com/2021/04/12/DCO.html)). Commits without that trailer are automatically rejected by CI in these projects, because they could lead to legal issues.

Needing to type out "Signed-off-by: My Name [email protected]" all the time is just not bearable. Having a -s in my git commit call is a no-brainer (and actually muscle memory for me by now). It should be as easy as that little -s in gitui IMO.

matthiasbeyer avatar Nov 03 '22 07:11 matthiasbeyer

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '23 11:05 stale[bot]

Still relevant.

matthiasbeyer avatar May 21 '23 11:05 matthiasbeyer

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 15 '23 06:12 stale[bot]

#1758 added support for sign-off. lets open another more specific issue for any other relevant trailer

extrawurst avatar Feb 27 '24 14:02 extrawurst