[PATCH v3 24/27] rebase -i: teach do_pick the option --signoff
- From
Fabian Ruch <bafain@gmail.com>
- Date
- Aug 18, 2014, 21:23 UTC
- Message-ID
- <e6224211727d9a1f3edfb00f417f4ac9e385b9f3.1408396036.git.bafain@gmail.com>
- In-Reply-To
- <cover.1408396036.git.bafain@gmail.com>
`do_pick` is the git-cherry-pick wrapper in git-rebase--interactive that is currently used to implement most of the to-do list commands and offers additional options that will eventually find their way onto to-do lists.
To extend the repertoire of available options, add the git-commit and git-cherry-pick option `--signoff` to the `do_pick` interface. It appends a Signed-off-by: line using the committer identity to the log message of the picked commit.
Signed-off-by: Fabian Ruch <bafain@gmail.com> --- git-rebase--interactive.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 6c75bc5..73c97a1 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -464,10 +464,15 @@ record_in_rewritten() { # Apply the changes introduced by the given commit to the current head. # -# do_pick [--reset-author] [--amend] [--file <file>] [--edit] <commit> +# do_pick [--signoff] [--reset-author] [--amend] [--file <file>] +# [--edit] <commit> # # Wrapper around git-cherry-pick. # +# -s, --signoff +# Insert a Signed-off-by: line using the committer identity at the +# end of the commit log message. This creates a fresh commit. +# # --reset-author # Pretend the changes were made for the first time. Declare that the # authorship of the resulting commit now belongs to the committer. @@ -504,6 +509,7 @@ record_in_rewritten() { do_pick () { allow_empty_message=y rewrite= + rewrite_signoff= rewrite_reset_author= rewrite_amend= rewrite_edit= @@ -511,6 +517,10 @@ do_pick () { while test $# -gt 0 do case "$1" in + -s|--signoff) + rewrite=y + rewrite_signoff=y + ;; --reset-author) rewrite=y rewrite_reset_author=y @@ -588,6 +598,7 @@ do_pick () { $do_with_author output git commit \ --allow-empty --no-post-rewrite -n --no-edit \ ${allow_empty_message:+--allow-empty-message} \ + ${rewrite_signoff:+--signoff} \ ${rewrite_amend:+--amend ${rewrite_reset_author:+--reset-author}} \ ${rewrite_edit:+--edit --commit-msg} \ ${rewrite_message:+--file "$rewrite_message"} \
-- 2.0.1