threads / patch / 25851

patchrebase: pass --signoff option to git am

Subject: [PATCH] rebase: pass --signoff option to git am

## tl;dr

8 messages between Nov 27, 2010 and Dec 6, 2010. Diffs are folded; open one to read it.

replies: 7people: 5as markdown or json

Giuseppe Bilotta· Nov 27, 2010, 11:15 UTC · lore

This allows people (like me) that forget to sign off their commits to do a single rebase pass e.g. while preparing the patchset for submission.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 Documentation/git-rebase.txt |    6 ++++++
 git-rebase.sh                |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
Show changes to 2 files +7 −1

Documentation/git-rebase.txt, git-rebase.sh

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 30e5c0e..d513e42 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -320,6 +320,12 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details).
 -p::
 --preserve-merges::
 	Instead of ignoring merges, try to recreate them.
+
+--signoff::
+	This flag is passed to 'git am' to sign off all the rebased
+	commits (see linkgit:git-am[1]).
+	Incompatible with the --interactive option.
+
 +
 This uses the `--interactive` machinery internally, but combining it
 with the `--interactive` option explicitly is generally not a good
diff --git a/git-rebase.sh b/git-rebase.sh
index 0e9d52a..9de03ee 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -354,7 +354,7 @@ do
 	--ignore-whitespace)
 		git_am_opt="$git_am_opt $1"
 		;;
-	--committer-date-is-author-date|--ignore-date)
+	--committer-date-is-author-date|--ignore-date|--signoff)
 		git_am_opt="$git_am_opt $1"
 		force_rebase=t
 		;;
-- 
1.7.3.2.184.gecaee
Sverre Rabbelier· Nov 28, 2010, 00:32 UTC · re: Giuseppe Bilotta · lore

Re: [PATCH] rebase: pass --signoff option to git am

Heya,

On Sat, Nov 27, 2010 at 12:15, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:

Show 8 quoted lines
>  -p::
>  --preserve-merges::
>        Instead of ignoring merges, try to recreate them.
> +
> +--signoff::
> +       This flag is passed to 'git am' to sign off all the rebased
> +       commits (see linkgit:git-am[1]).
> +       Incompatible with the --interactive option.

The one above that does have a shorthand (-p), why should we (not?) give --signoff it's customary -s shorthand here?

-- 
Cheers,

Sverre Rabbelier
Martin von Zweigbergk· Nov 27, 2010, 19:05 UTC · re: Sverre Rabbelier · lore

Re: [PATCH] rebase: pass --signoff option to git am

On Sun, 28 Nov 2010, Sverre Rabbelier wrote:
Show 15 quoted lines
> Heya,
> 
> On Sat, Nov 27, 2010 at 12:15, Giuseppe Bilotta
> <giuseppe.bilotta@gmail.com> wrote:
> >  -p::
> >  --preserve-merges::
> >        Instead of ignoring merges, try to recreate them.
> > +
> > +--signoff::
> > +       This flag is passed to 'git am' to sign off all the rebased
> > +       commits (see linkgit:git-am[1]).
> > +       Incompatible with the --interactive option.
> 
> The one above that does have a shorthand (-p), why should we (not?)
> give --signoff it's customary -s shorthand here?

The '-s' flag is unfortunately already taken. It is used for specifying a merge strategy.

/Martin
Giuseppe Bilotta· Nov 28, 2010, 08:00 UTC · re: Martin von Zweigbergk · lore

Re: [PATCH] rebase: pass --signoff option to git am

On Sat, Nov 27, 2010 at 8:05 PM, Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> wrote:

Show 21 quoted lines
>
> On Sun, 28 Nov 2010, Sverre Rabbelier wrote:
>
>> Heya,
>>
>> On Sat, Nov 27, 2010 at 12:15, Giuseppe Bilotta
>> <giuseppe.bilotta@gmail.com> wrote:
>> >  -p::
>> >  --preserve-merges::
>> >        Instead of ignoring merges, try to recreate them.
>> > +
>> > +--signoff::
>> > +       This flag is passed to 'git am' to sign off all the rebased
>> > +       commits (see linkgit:git-am[1]).
>> > +       Incompatible with the --interactive option.
>>
>> The one above that does have a shorthand (-p), why should we (not?)
>> give --signoff it's customary -s shorthand here?
>
> The '-s' flag is unfortunately already taken. It is used for
> specifying a merge strategy.

In fact, this is why I was a little skeptical myself about submitting this patch. What if people start remembering that rebase supports --signoff and implicity assume that -s is also a valid shortcut? Funky errors. (I've been bittem myself by similar situations for whitespace support. Can I pass -b or not? Will it mean --ignore-whitespace?)

-- 
Giuseppe "Oblomov" Bilotta
Kevin Ballard· Nov 29, 2010, 22:57 UTC · re: Giuseppe Bilotta · lore

Re: [PATCH] rebase: pass --signoff option to git am

On Nov 27, 2010, at 3:15 AM, Giuseppe Bilotta wrote:
> This allows people (like me) that forget to sign off their commits to do
> a single rebase pass e.g. while preparing the patchset for submission.

You're probably already aware, but git format-patch supports the -s/--signoff flags to sign off commits as they're prepared. There's even a config var you can set to make this the default (format.signoff = true).

-Kevin Ballard
Giuseppe Bilotta· Nov 30, 2010, 08:09 UTC · re: Kevin Ballard · lore

Re: [PATCH] rebase: pass --signoff option to git am

On Mon, Nov 29, 2010 at 11:57 PM, Kevin Ballard <kevin@sb.org> wrote:
Show 8 quoted lines
> On Nov 27, 2010, at 3:15 AM, Giuseppe Bilotta wrote:
>
>> This allows people (like me) that forget to sign off their commits to do
>> a single rebase pass e.g. while preparing the patchset for submission.
>
> You're probably already aware, but git format-patch supports the -s/--signoff
> flags to sign off commits as they're prepared. There's even a config var
> you can set to make this the default (format.signoff = true).

That works if you're sharing your patches with format-patch, but not for example when asking for a pull. Maybe I should extend the commit message to include this case.

-- 
Giuseppe "Oblomov" Bilotta
Giuseppe Bilotta· Dec 6, 2010, 10:41 UTC · re: Giuseppe Bilotta · lore

Re: [PATCH] rebase: pass --signoff option to git am

On Tue, Nov 30, 2010 at 9:09 AM, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:

Show 13 quoted lines
> On Mon, Nov 29, 2010 at 11:57 PM, Kevin Ballard <kevin@sb.org> wrote:
>> On Nov 27, 2010, at 3:15 AM, Giuseppe Bilotta wrote:
>>
>>> This allows people (like me) that forget to sign off their commits to do
>>> a single rebase pass e.g. while preparing the patchset for submission.
>>
>> You're probably already aware, but git format-patch supports the -s/--signoff
>> flags to sign off commits as they're prepared. There's even a config var
>> you can set to make this the default (format.signoff = true).
>
> That works if you're sharing your patches with format-patch, but not
> for example when asking for a pull. Maybe I should extend the commit
> message to include this case.

For what it's worth, somebody on #git just asked how to signoff a bunch of patches. The answer was to rebase -i and sign off each one of them. This is exactly the kind of usage that my patch would simplify. Any chance of it getting merged?

-- 
Giuseppe "Oblomov" Bilotta
Jonathan Nieder· Dec 6, 2010, 17:28 UTC · re: Giuseppe Bilotta · lore

Re: [PATCH] rebase: pass --signoff option to git am

Giuseppe Bilotta wrote:
> For what it's worth, somebody on #git just asked how to signoff a
> bunch of patches. The answer was to rebase -i and sign off each one of
> them.
How I would do it in existing git:
	git branch oldhead
	git reset --keep base
	git log --oneline --graph HEAD..oldhead;	# the right patches?
	git cherry-pick -s HEAD..oldhead
	git diff oldhead
Or without multiple-cherry-pick, maybe:
	git branch oldhead
	git reset --keep base
	git format-patch -k --stdout HEAD..oldhead >series
	git am -s -3 -i series;	# the right patches?
	git diff oldhead
No opinion on the automatic-signoff-in-rebase here.

← back to recent threads