From: Steffen Prohaska <prohaska@zib.de>
To: git@vger.kernel.org
Cc: Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH] rebase: add --signoff option
Date: Sun, 30 Sep 2007 18:15:11 +0200 [thread overview]
Message-ID: <11911689111797-git-send-email-prohaska@zib.de> (raw)
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
next reply other threads:[~2007-09-30 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-30 16:15 Steffen Prohaska [this message]
2007-09-30 21:30 ` [PATCH] rebase: add --signoff option 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11911689111797-git-send-email-prohaska@zib.de \
--to=prohaska@zib.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).