* [PATCH] rebase: add --signoff option
@ 2007-09-30 16:15 Steffen Prohaska
2007-09-30 21:30 ` Johannes Schindelin
2007-10-01 8:20 ` Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Steffen Prohaska @ 2007-09-30 16:15 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
When preparing a series of commits for upstream you may
need to signoff commits if you forgot to do so earlier.
This patch teaches git-rebase to signoff during rebase
if you pass the option --signoff.
Notes
1) --signoff cannot be used simultaneously with --interactive.
2) --signoff forces a rebase even if current path is a
descendant of <upstream>.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
Documentation/git-rebase.txt | 9 +++++++--
git-rebase--interactive.sh | 3 +++
git-rebase.sh | 10 ++++++++--
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index e8e7579..befe337 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -8,8 +8,8 @@ git-rebase - Forward-port local commits to the updated upstream head
SYNOPSIS
--------
[verse]
-'git-rebase' [-i | --interactive] [-v | --verbose] [-m | --merge]
- [-C<n>] [ --whitespace=<option>] [-p | --preserve-merges]
+'git-rebase' [-i | --interactive] [-v | --verbose] [-m | --merge] [-C<n>]
+ [--signoff] [ --whitespace=<option>] [-p | --preserve-merges]
[--onto <newbase>] <upstream> [<branch>]
'git-rebase' --continue | --skip | --abort
@@ -201,6 +201,11 @@ OPTIONS
is used instead (`git-merge-recursive` when merging a single
head, `git-merge-octopus` otherwise). This implies --merge.
+--signoff::
+ Add `Signed-off-by:` line to each commit message, using
+ the committer identity of yourself.
+
+
-v, \--verbose::
Display a diffstat of what changed upstream since the last rebase.
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 8568a4f..29cef17 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -395,6 +395,9 @@ do
-C*)
die "Interactive rebase uses merge, so $1 does not make sense"
;;
+ --si|--sig|--sign|--signo|--signof|--signoff)
+ die "Interactive rebase doesn't support simultaneous signoff."
+ ;;
-v|--verbose)
VERBOSE=t
;;
diff --git a/git-rebase.sh b/git-rebase.sh
index 1583402..3b06bf4 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -46,6 +46,7 @@ dotest=$GIT_DIR/.dotest-merge
prec=4
verbose=
git_am_opt=
+opt_signoff=
continue_merge () {
test -n "$prev_head" || die "prev_head must be defined"
@@ -200,7 +201,7 @@ do
;;
-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
--strateg=*|--strategy=*|\
- -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
+ -s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
case "$#,$1" in
*,*=*)
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
@@ -221,6 +222,10 @@ do
-C*)
git_am_opt="$git_am_opt $1"
;;
+ --si|--sig|--sign|--signo|--signof|--signoff)
+ git_am_opt="$git_am_opt --signoff"
+ opt_signoff=t
+ ;;
-*)
usage
;;
@@ -302,8 +307,9 @@ branch=$(git rev-parse --verify "${branch_name}^0") || exit
# Check if we are already based on $onto with linear history,
# but this should be done only when upstream and onto are the same.
+# The check must also be skipped if signoff is requested.
mb=$(git merge-base "$onto" "$branch")
-if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
+if test "$upstream" = "$onto" && test "$mb" = "$onto" && test -z "$opt_signoff" &&
# linear history?
! git rev-list --parents "$onto".."$branch" | grep " .* " > /dev/null
then
--
1.5.3.3.127.g40d17
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rebase: add --signoff option
2007-09-30 16:15 [PATCH] rebase: add --signoff option Steffen Prohaska
@ 2007-09-30 21:30 ` Johannes Schindelin
2007-09-30 21:38 ` Steffen Prohaska
2007-10-01 8:20 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-09-30 21:30 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: git
Hi,
On Sun, 30 Sep 2007, Steffen Prohaska wrote:
> When preparing a series of commits for upstream you may
> need to signoff commits if you forgot to do so earlier.
Why not use format-patch's --signoff option for that?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rebase: add --signoff option
2007-09-30 21:30 ` Johannes Schindelin
@ 2007-09-30 21:38 ` Steffen Prohaska
2007-09-30 21:41 ` Johannes Schindelin
0 siblings, 1 reply; 6+ messages in thread
From: Steffen Prohaska @ 2007-09-30 21:38 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
On Sep 30, 2007, at 11:30 PM, Johannes Schindelin wrote:
> On Sun, 30 Sep 2007, Steffen Prohaska wrote:
>
>> When preparing a series of commits for upstream you may
>> need to signoff commits if you forgot to do so earlier.
>
> Why not use format-patch's --signoff option for that?
format-patch is fine for mail. But if I either push the commits
to a shared repo (like msysgit's mob) or ask upstream to pull
from my public repo format-patch doesn't help directly.
Steffen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rebase: add --signoff option
2007-09-30 21:38 ` Steffen Prohaska
@ 2007-09-30 21:41 ` Johannes Schindelin
2007-10-01 4:59 ` Steffen Prohaska
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-09-30 21:41 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: git
Hi,
On Sun, 30 Sep 2007, Steffen Prohaska wrote:
> On Sep 30, 2007, at 11:30 PM, Johannes Schindelin wrote:
>
> > On Sun, 30 Sep 2007, Steffen Prohaska wrote:
> >
> > > When preparing a series of commits for upstream you may need to
> > > signoff commits if you forgot to do so earlier.
> >
> > Why not use format-patch's --signoff option for that?
>
> format-patch is fine for mail. But if I either push the commits to a
> shared repo (like msysgit's mob) or ask upstream to pull from my public
> repo format-patch doesn't help directly.
Fair enough. But maybe "rebase --interactive" is not too difficult,
either?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rebase: add --signoff option
2007-09-30 21:41 ` Johannes Schindelin
@ 2007-10-01 4:59 ` Steffen Prohaska
0 siblings, 0 replies; 6+ messages in thread
From: Steffen Prohaska @ 2007-10-01 4:59 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
On Sep 30, 2007, at 11:41 PM, Johannes Schindelin wrote:
> On Sun, 30 Sep 2007, Steffen Prohaska wrote:
>
>> On Sep 30, 2007, at 11:30 PM, Johannes Schindelin wrote:
>>
>>> On Sun, 30 Sep 2007, Steffen Prohaska wrote:
>>>
>>>> When preparing a series of commits for upstream you may need to
>>>> signoff commits if you forgot to do so earlier.
>>>
>>> Why not use format-patch's --signoff option for that?
>>
>> format-patch is fine for mail. But if I either push the commits to a
>> shared repo (like msysgit's mob) or ask upstream to pull from my
>> public
>> repo format-patch doesn't help directly.
>
> Fair enough. But maybe "rebase --interactive" is not too difficult,
> either?
But not too easy either because "rebase --interactive" is based on
"git merge" and not "git am". You can just use a two step process
instead and first "rebase --interactive" followed by
"rebase --signoff".
Steffen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rebase: add --signoff option
2007-09-30 16:15 [PATCH] rebase: add --signoff option Steffen Prohaska
2007-09-30 21:30 ` Johannes Schindelin
@ 2007-10-01 8:20 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2007-10-01 8:20 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: git
Steffen Prohaska <prohaska@zib.de> writes:
> When preparing a series of commits for upstream you may
> need to signoff commits if you forgot to do so earlier.
> This patch teaches git-rebase to signoff during rebase
> if you pass the option --signoff.
>
> Notes
> 1) --signoff cannot be used simultaneously with --interactive.
> 2) --signoff forces a rebase even if current path is a
> descendant of <upstream>.
>
> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
I do not think it is fatal for --signoff to be incompatible with
the "interactive" mode is fatal, but lack of mention in the
documentation is. Also this would need test scripts to prevent
it from getting broken by future changes by others. I'd like to
see ones that test at least the cases where (1) nobody has
sign-off, (2) you do not have sign-off but others do, and (3)
you already have sign-off at the end.
But I do like the general concept.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-01 8:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-30 16:15 [PATCH] rebase: add --signoff option Steffen Prohaska
2007-09-30 21:30 ` Johannes Schindelin
2007-09-30 21:38 ` Steffen Prohaska
2007-09-30 21:41 ` Johannes Schindelin
2007-10-01 4:59 ` Steffen Prohaska
2007-10-01 8:20 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).