commit: fix memory leak in `reduce_heads()`
[gitweb.git] / git-rebase--interactive.sh
index 4734094a3f1aaa7d7c767a0740b46dd6abdd6f7a..29b7e8824b53abeaa68780b95d5954f67f734098 100644 (file)
@@ -5,7 +5,7 @@
 # Copyright (c) 2006 Johannes E. Schindelin
 #
 # The original idea comes from Eric W. Biederman, in
-# http://article.gmane.org/gmane.comp.version-control.git/22407
+# https://public-inbox.org/git/m1odwkyuf5.fsf_-_@ebiederm.dsl.xmission.com/
 #
 # The file containing rebase commands, comments, and empty lines.
 # This file is created by "git rebase -i" then edited by the user.  As
@@ -281,7 +281,7 @@ pick_one () {
 
        test -d "$rewritten" &&
                pick_one_preserving_merges "$@" && return
-       output eval git cherry-pick \
+       output eval git cherry-pick $allow_rerere_autoupdate \
                        ${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
                        "$strategy_args" $empty_args $ff "$@"
 
@@ -393,7 +393,8 @@ pick_one_preserving_merges () {
                        merge_args="--no-log --no-ff"
                        if ! do_with_author output eval \
                        'git merge ${gpg_sign_opt:+"$gpg_sign_opt"} \
-                               $merge_args $strategy_args -m "$msg_content" $new_parents'
+                               $allow_rerere_autoupdate $merge_args \
+                               $strategy_args -m "$msg_content" $new_parents'
                        then
                                printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
                                die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"
@@ -401,7 +402,7 @@ pick_one_preserving_merges () {
                        echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list"
                        ;;
                *)
-                       output eval git cherry-pick \
+                       output eval git cherry-pick $allow_rerere_autoupdate \
                                ${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
                                "$strategy_args" "$@" ||
                                die_with_patch $sha1 "$(eval_gettext "Could not pick \$sha1")"
@@ -1069,6 +1070,10 @@ git_rebase__interactive () {
 
 case "$action" in
 continue)
+       if test ! -d "$rewritten"
+       then
+               exec git rebase--helper ${force_rebase:+--no-ff} --continue
+       fi
        # do we have anything to commit?
        if git diff-index --cached --quiet HEAD --
        then
@@ -1128,6 +1133,10 @@ first and then run 'git rebase --continue' again.")"
 skip)
        git rerere clear
 
+       if test ! -d "$rewritten"
+       then
+               exec git rebase--helper ${force_rebase:+--no-ff} --continue
+       fi
        do_rest
        return 0
        ;;
@@ -1314,6 +1323,11 @@ expand_todo_ids
 test -d "$rewritten" || test -n "$force_rebase" || skip_unnecessary_picks
 
 checkout_onto
+if test -z "$rebase_root" && test ! -d "$rewritten"
+then
+       require_clean_work_tree "rebase"
+       exec git rebase--helper ${force_rebase:+--no-ff} --continue
+fi
 do_rest
 
 }