threads / patch / 44928

patchrebase: pass --signoff option to git am

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

## tl;dr

8 messages between Jan 21, 2017 and Jan 26, 2017. Diffs are folded; open one to read it.

replies: 7people: 2as markdown or json

Giuseppe Bilotta· Jan 21, 2017, 10:49 UTC · lore
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 Documentation/git-rebase.txt | 5 +++++
 git-rebase.sh                | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
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 67d48e6883..e6f0b93337 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -385,6 +385,11 @@ have the long commit hash prepended to the format.
 	Recreate merge commits instead of flattening the history by replaying
 	commits a merge commit introduces. Merge conflict resolutions or manual
 	amendments to merge commits are not preserved.
+
+--signoff::
+	This flag is passed to 'git am' to sign off all the rebased
+	commits (see linkgit:git-am[1]).
+
 +
 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 48d7c5ded4..e468a061f9 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -34,6 +34,7 @@
 autosquash         move commits that begin with squash!/fixup! under -i
 committer-date-is-author-date! passed to 'git am'
 ignore-date!       passed to 'git am'
+signoff!           passed to 'git am'
 whitespace=!       passed to 'git apply'
 ignore-whitespace! passed to 'git apply'
 C=!                passed to 'git apply'
@@ -321,7 +322,7 @@ run_pre_rebase_hook ()
 	--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
 		;;
-- 
2.11.0.585.g56041942c3.dirty
Junio C Hamano· Jan 23, 2017, 18:13 UTC · re: Giuseppe Bilotta · lore

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

Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
Show 5 quoted lines
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
>  Documentation/git-rebase.txt | 5 +++++
>  git-rebase.sh                | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)

Should we plan to extend this to the interactive backend that is shared between rebase -i and rebase -m, too? Or is this patch already sufficient to cover them?

Show 37 quoted lines
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 67d48e6883..e6f0b93337 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -385,6 +385,11 @@ have the long commit hash prepended to the format.
>  	Recreate merge commits instead of flattening the history by replaying
>  	commits a merge commit introduces. Merge conflict resolutions or manual
>  	amendments to merge commits are not preserved.
> +
> +--signoff::
> +	This flag is passed to 'git am' to sign off all the rebased
> +	commits (see linkgit:git-am[1]).
> +
>  +
>  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 48d7c5ded4..e468a061f9 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -34,6 +34,7 @@
>  autosquash         move commits that begin with squash!/fixup! under -i
>  committer-date-is-author-date! passed to 'git am'
>  ignore-date!       passed to 'git am'
> +signoff!           passed to 'git am'
>  whitespace=!       passed to 'git apply'
>  ignore-whitespace! passed to 'git apply'
>  C=!                passed to 'git apply'
> @@ -321,7 +322,7 @@ run_pre_rebase_hook ()
>  	--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
>  		;;
Giuseppe Bilotta· Jan 23, 2017, 20:03 UTC · re: Junio C Hamano · lore

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

On Mon, Jan 23, 2017 at 7:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Should we plan to extend this to the interactive backend that is
> shared between rebase -i and rebase -m, too?  Or is this patch
> already sufficient to cover them?

AFAIK this is sufficient for both, in the sense that I've used it with git rebase -i and it works.

Junio C Hamano· Jan 23, 2017, 20:16 UTC · re: Giuseppe Bilotta · lore

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

Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
Show 8 quoted lines
> On Mon, Jan 23, 2017 at 7:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Should we plan to extend this to the interactive backend that is
>> shared between rebase -i and rebase -m, too?  Or is this patch
>> already sufficient to cover them?
>
> AFAIK this is sufficient for both, in the sense that I've used it with
> git rebase -i and it works.
That is a good news and at the same time a bit awkard one ;-)  

The mention of "passed to 'git am'" twice in the documentation and help text would lead people to think "rebase -i" would not be affected and (1) would need more work to do so, or (2) the user does not want "rebase -i" to be unaffected for whatever reason, and gets surprised to see that it actually does get affected.

In any case, will queue as-is so that we won't lose the patch while waiting for people to raise their opinions.

Thanks.
Giuseppe Bilotta· Jan 23, 2017, 22:35 UTC · re: Junio C Hamano · lore

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

On Mon, Jan 23, 2017 at 9:16 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>
>> On Mon, Jan 23, 2017 at 7:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>
>>> Should we plan to extend this to the interactive backend that is
>>> shared between rebase -i and rebase -m, too?  Or is this patch
>>> already sufficient to cover them?
>>
>> AFAIK this is sufficient for both, in the sense that I've used it with
>> git rebase -i and it works.
>
> That is a good news and at the same time a bit awkard one ;-)
>
> The mention of "passed to 'git am'" twice in the documentation and
> help text would lead people to think "rebase -i" would not be
> affected and (1) would need more work to do so, or (2) the user does
> not want "rebase -i" to be unaffected for whatever reason, and gets
> surprised to see that it actually does get affected.

I'm not sure I follow. If the user doesn't want to signoff during a rebase, they can simply not pass --signoff. If they do, they can not pass it. Am I missing something?

> In any case, will queue as-is so that we won't lose the patch while
> waiting for people to raise their opinions.
Thanks.
-- 
Giuseppe "Oblomov" Bilotta
Junio C Hamano· Jan 23, 2017, 23:27 UTC · re: Giuseppe Bilotta · lore

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

Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
Show 23 quoted lines
> On Mon, Jan 23, 2017 at 9:16 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>>
>>> On Mon, Jan 23, 2017 at 7:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>>
>>>> Should we plan to extend this to the interactive backend that is
>>>> shared between rebase -i and rebase -m, too?  Or is this patch
>>>> already sufficient to cover them?
>>>
>>> AFAIK this is sufficient for both, in the sense that I've used it with
>>> git rebase -i and it works.
>>
>> That is a good news and at the same time a bit awkard one ;-)
>>
>> The mention of "passed to 'git am'" twice in the documentation and
>> help text would lead people to think "rebase -i" would not be
>> affected and (1) would need more work to do so, or (2) the user does
>> not want "rebase -i" to be unaffected for whatever reason, and gets
>> surprised to see that it actually does get affected.
>
> I'm not sure I follow. If the user doesn't want to signoff during a
> rebase, they can simply not pass --signoff. If they do, they can not
> pass it. Am I missing something?
alias.

Which also means that there needs to be --no-signoff option that can be given to countermand an earlier --signoff, if a user did

	[alias] rb = rebase --signoff
and wants to disable it one time only with
	$ git rb --no-signoff
Show 5 quoted lines
>
>> In any case, will queue as-is so that we won't lose the patch while
>> waiting for people to raise their opinions.
>
> Thanks.

Thanks. The final version would also need tests, so it may be a good time to start thinking about what aspect of this feature wants to be protected against future breakages.

Giuseppe Bilotta· Jan 24, 2017, 07:06 UTC · re: Junio C Hamano · lore

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

On Tue, Jan 24, 2017 at 12:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>>
>> I'm not sure I follow. If the user doesn't want to signoff during a
>> rebase, they can simply not pass --signoff. If they do, they can not
>> pass it. Am I missing something?
>
> alias.
>
> Which also means that there needs to be --no-signoff option that can
> be given to countermand an earlier --signoff, if a user did
>
>         [alias] rb = rebase --signoff
>
> and wants to disable it one time only with
>
>         $ git rb --no-signoff
Oh, right, good point. This should be easy, I'll give this a go.
Show 8 quoted lines
>>> In any case, will queue as-is so that we won't lose the patch while
>>> waiting for people to raise their opinions.
>>
>> Thanks.
>
> Thanks.  The final version would also need tests, so it may be a
> good time to start thinking about what aspect of this feature wants
> to be protected against future breakages.

I have troubles thinking how it could go wrong. The most obvious thing I can think of is it could not be remembered after an interruption+continue. I'll think about this some more.

-- 
Giuseppe "Oblomov" Bilotta
Giuseppe Bilotta· Jan 26, 2017, 18:18 UTC · re: Giuseppe Bilotta · lore

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

On Mon, Jan 23, 2017 at 9:03 PM, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:

Show 8 quoted lines
> On Mon, Jan 23, 2017 at 7:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Should we plan to extend this to the interactive backend that is
>> shared between rebase -i and rebase -m, too?  Or is this patch
>> already sufficient to cover them?
>
> AFAIK this is sufficient for both, in the sense that I've used it with
> git rebase -i and it works.

Hm, something very strange is going on, I've just tested the patch on top of current next and for some reason the signoff line does not get added. The command-line option gets passed to git am, but I get no signoff for some reason, so something is failing down the line, I'll have to investigate.

-- 
Giuseppe "Oblomov" Bilotta

← back to recent threads