From: Junio C Hamano Date: Thu, 28 Jul 2016 18:25:52 +0000 (-0700) Subject: Merge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint X-Git-Tag: v2.9.3~58 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ae8daba6019fba266ba7afd88aa642bf6994fe2c?hp=-c Merge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint "git rebase -i --autostash" did not restore the auto-stashed change when the operation was aborted. * ps/rebase-i-auto-unstash-upon-abort: rebase -i: restore autostash on abort --- ae8daba6019fba266ba7afd88aa642bf6994fe2c diff --combined git-rebase--interactive.sh index 05f22e43cc,8fe7a7015b..4f499d2c13 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@@ -81,14 -81,17 +81,14 @@@ rewritten_pending="$state_dir"/rewritte # and leaves CR at the end instead. cr=$(printf "\015") -strategy_args= -if test -n "$do_merge" -then - strategy_args=${strategy:+--strategy=$strategy} - eval ' - for strategy_opt in '"$strategy_opts"' - do - strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")" - done - ' -fi +strategy_args=${strategy:+--strategy=$strategy} +test -n "$strategy_opts" && +eval ' + for strategy_opt in '"$strategy_opts"' + do + strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")" + done +' GIT_CHERRY_PICK_HELP="$resolvemsg" export GIT_CHERRY_PICK_HELP @@@ -192,6 -195,7 +192,6 @@@ make_patch () die_with_patch () { echo "$1" > "$state_dir"/stopped-sha make_patch "$1" - git rerere die "$2" } @@@ -212,6 -216,7 +212,7 @@@ exit_with_patch () } die_abort () { + apply_autostash rm -rf "$state_dir" die "$1" } @@@ -548,8 -553,7 +549,8 @@@ do_next () mark_action_done do_pick $sha1 "$rest" - warn "Stopped at $sha1... $rest" + sha1_abbrev=$(git rev-parse --short $sha1) + warn "Stopped at $sha1_abbrev... $rest" exit_with_patch $sha1 0 ;; squash|s|fixup|f) @@@ -866,12 -870,12 +867,12 @@@ add_exec_commands () # $3: the input filename check_commit_sha () { badsha=0 - if test -z $1 + if test -z "$1" then badsha=1 else sha1_verif="$(git rev-parse --verify --quiet $1^{commit})" - if test -z $sha1_verif + if test -z "$sha1_verif" then badsha=1 fi @@@ -1038,8 -1042,8 +1039,8 @@@ check_todo_list () # below were not inside any function, and expected to return # to the function that dot-sourced us. # -# However, FreeBSD /bin/sh misbehaves on such a construct and -# continues to run the statements that follow such a "return". +# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a +# construct and continue to run the statements that follow such a "return". # As a work-around, we introduce an extra layer of a function # here, and immediately call it after defining it. git_rebase__interactive () { @@@ -1234,8 -1238,7 +1235,8 @@@ the git rev-list $revisions | while read rev do - if test -f "$rewritten"/$rev && test "$(sane_grep "$rev" "$state_dir"/not-cherry-picks)" = "" + if test -f "$rewritten"/$rev && + ! sane_grep "$rev" "$state_dir"/not-cherry-picks >/dev/null then # Use -f2 because if rev-list is telling us this commit is # not worthwhile, we don't want to track its multiple heads,