summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-05-19 13:17:56 -0700
committerJunio C Hamano <gitster@pobox.com>2015-05-19 13:17:56 -0700
commiteae0216646039b203cd60c4294ef79f805fbd696 (patch)
treeb374774c4f0e3c7923123babf06de68e2dfd9188 /git-rebase--interactive.sh
parent072f391c53cb6845777f01db03d9b06c33ac87e3 (diff)
parent8cbc57ca1109ba455c6098654b7d732a01fd89fd (diff)
downloadgit-eae0216646039b203cd60c4294ef79f805fbd696.tar.gz
Merge branch 'ph/rebase-i-redo'
"git rebase -i" moved the "current" command from "todo" to "done" a bit too prematurely, losing a step when a "pick" did not even start. * ph/rebase-i-redo: rebase -i: redo tasks that die during cherry-pick
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r--git-rebase--interactive.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 08e5d86fe5..bab0dccc04 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -132,6 +132,16 @@ mark_action_done () {
fi
}
+# Put the last action marked done at the beginning of the todo list
+# again. If there has not been an action marked done yet, leave the list of
+# items on the todo list unchanged.
+reschedule_last_action () {
+ tail -n 1 "$done" | cat - "$todo" >"$todo".new
+ sed -e \$d <"$done" >"$done".new
+ mv -f "$todo".new "$todo"
+ mv -f "$done".new "$done"
+}
+
append_todo_help () {
git stripspace --comment-lines >>"$todo" <<\EOF
@@ -252,6 +262,12 @@ pick_one () {
output eval git cherry-pick \
${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
"$strategy_args" $empty_args $ff "$@"
+
+ # If cherry-pick dies it leaves the to-be-picked commit unrecorded. Reschedule
+ # previous task so this commit is not lost.
+ ret=$?
+ case "$ret" in [01]) ;; *) reschedule_last_action ;; esac
+ return $ret
}
pick_one_preserving_merges () {