summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorLibravatar Phillip Wood <phillip.wood@dunelm.org.uk>2018-03-20 11:10:55 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-29 11:09:03 -0700
commita852ec7f273cf61296a80ddfc26c23acf2163f2f (patch)
tree6abd2e0b2cb0e5b1de53c303950d4c661d341921 /git-rebase.sh
parentMerge branch 'pw/rebase-keep-empty-fixes' into pw/rebase-signoff (diff)
downloadtgif-a852ec7f273cf61296a80ddfc26c23acf2163f2f.tar.xz
rebase: extend --signoff support
Allow --signoff to be used with --interactive and --merge. In interactive mode only commits marked to be picked, edited or reworded will be signed off. The main motivation for this patch was to allow one to run 'git rebase --exec "make check" --signoff' which is useful when preparing a patch series for publication and is more convenient than doing the signoff with another --exec command. This change also allows --root without --onto to work with --signoff as well (--root with --onto was already supported). Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 37b8f13971..5a5a65f3d2 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -90,6 +90,7 @@ action=
preserve_merges=
autosquash=
keep_empty=
+signoff=
test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t
case "$(git config --bool commit.gpgsign)" in
true) gpg_sign_opt=-S ;;
@@ -119,6 +120,10 @@ read_basic_state () {
allow_rerere_autoupdate="$(cat "$state_dir"/allow_rerere_autoupdate)"
test -f "$state_dir"/gpg_sign_opt &&
gpg_sign_opt="$(cat "$state_dir"/gpg_sign_opt)"
+ test -f "$state_dir"/signoff && {
+ signoff="$(cat "$state_dir"/signoff)"
+ force_rebase=t
+ }
}
write_basic_state () {
@@ -133,6 +138,7 @@ write_basic_state () {
test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
"$state_dir"/allow_rerere_autoupdate
test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
+ test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
}
output () {
@@ -328,7 +334,13 @@ do
--ignore-whitespace)
git_am_opt="$git_am_opt $1"
;;
- --committer-date-is-author-date|--ignore-date|--signoff|--no-signoff)
+ --signoff)
+ signoff=--signoff
+ ;;
+ --no-signoff)
+ signoff=
+ ;;
+ --committer-date-is-author-date|--ignore-date)
git_am_opt="$git_am_opt $1"
force_rebase=t
;;
@@ -458,6 +470,12 @@ then
git_format_patch_opt="$git_format_patch_opt --progress"
fi
+if test -n "$signoff"
+then
+ git_am_opt="$git_am_opt $signoff"
+ force_rebase=t
+fi
+
if test -z "$rebase_root"
then
case "$#" in