Request for git merge --signoff

3 messages, 3 authors, 2017-07-25 · open the first message on its own page

Request for git merge --signoff

From: Dan Kohn <hidden>
Date: 2017-07-01 15:24:46

https://github.com/coreinfrastructure/best-practices-badge is a user
of the https://github.com/probot/dco bot which checks that commits
have a signoff. The issue is that there is no `--signoff` option in
git for merge commits, which is a standard part of our workflow with
feature branches. Here is a workflow where we currently get stuck:
(master)$ git checkout -b feature-branch
# make some changes
(feature-branch)$ git commit -sam 'Adding features'
# Changes have occurred on master so need to add them for easier merge
(feature-branch)$ git fetch
(feature-branch)$ git merge origin/master
# Save default commit message
(feature-branch)$ git push
# This now fails the DCObot check because the merge commit is not signed.
This alternative workflow works, but is obviously tedious:
# First 3 steps are the same
(feature-branch)$ git merge origin/master
# Save default commit message
(feature-branch)$ git commit --amend -s
# Commit message now has signoff line
(feature-branch)$ git push
# This now passes the DCObot check.
Or, I could manually add the Signoff line to the proposed git merge
commit message, which would allow me to skip the `--amend` step.

Could you please add a `--signoff` option to `git merge`?

Probot issue reference: https://github.com/probot/dco/issues/13
--
Dan Kohn <mailto:dan@linuxfoundation.org>
Executive Director, Cloud Native Computing Foundation <https://cncf.io/>
tel:+1-415-233-1000

Re: Request for git merge --signoff

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2017-07-01 22:15:28

On Sat, Jul 01 2017, Dan Kohn jotted:
https://github.com/coreinfrastructure/best-practices-badge is a user
of the https://github.com/probot/dco bot which checks that commits
have a signoff. The issue is that there is no `--signoff` option in
git for merge commits.
I think it's fine to add such a feature, but it seems like an obvious
bug to me in such a bot[1] that it's enforcing the DCO on merge commits.

The entire point of the DCO is to certify that you have the rights to
submit the patch etc., it's quite dubious to be applying that to merge
commits which contain no original work (most of the time, although of
course a merge commit can have significant conflict resolution).

So yeah, it would make sense to have a --signoff option, especially to
use when the merge actually does contain original work, but your stated
reason for wanting this just seems like an easily solved bug in the bot:
Exclude those commits that have no patch contents.

1. https://github.com/probot/dco/

Re: Request for git merge --signoff

From: Christian Couder <hidden>
Date: 2017-07-25 05:42:51

On Sat, Jul 1, 2017 at 5:24 PM, Dan Kohn [off-list ref] wrote:
https://github.com/coreinfrastructure/best-practices-badge is a user
of the https://github.com/probot/dco bot which checks that commits
have a signoff. The issue is that there is no `--signoff` option in
git for merge commits, which is a standard part of our workflow with
feature branches. Here is a workflow where we currently get stuck:
[...]
Or, I could manually add the Signoff line to the proposed git merge
commit message, which would allow me to skip the `--amend` step.
Perhaps you could use a prepare-commit-msg hook (or maybe a commit-msg
hook) to automatically add your Signoff line to any commit message if
it isn't there already.

In the prepare-commit-msg hook sample there is already commented out
code to do that:

https://github.com/git/git/blob/master/templates/hooks--prepare-commit-msg.sample#L35-L36

Alternatively you might want to use `git interpret-trailers` to do
that or more fancy trailer related things.
Could you please add a `--signoff` option to `git merge`?
I am not opposed to add a `--signoff` option to `git merge`, but I
think the main plan to improve git in this area has been to first make
it possible for git commands that can create commits to accept options
like "--trailer 'Signed-off-by: Alice [off-list ref]'" and to
pass them to `git interpret-trailers` (or its underlying code).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help