git-remote: exit with non-zero status after detecting error in "rm".
[gitweb.git] / git-rebase--interactive.sh
index d751984f8e379163ba35c074384309a5cb750a70..8568a4fd421d7e60512f0dfc37392bded07419b1 100755 (executable)
@@ -36,10 +36,9 @@ warn () {
 output () {
        case "$VERBOSE" in
        '')
-               "$@" > "$DOTEST"/output 2>&1
+               output=$("$@" 2>&1 )
                status=$?
-               test $status != 0 &&
-                       cat "$DOTEST"/output
+               test $status != 0 && printf "%s\n" "$output"
                return $status
                ;;
        *)
@@ -233,14 +232,14 @@ do_next () {
        '#'*|'')
                mark_action_done
                ;;
-       pick)
+       pick|p)
                comment_for_reflog pick
 
                mark_action_done
                pick_one $sha1 ||
                        die_with_patch $sha1 "Could not apply $sha1... $rest"
                ;;
-       edit)
+       edit|e)
                comment_for_reflog edit
 
                mark_action_done
@@ -255,7 +254,7 @@ do_next () {
                warn
                exit 0
                ;;
-       squash)
+       squash|s)
                comment_for_reflog squash
 
                has_action "$DONE" ||
@@ -264,7 +263,7 @@ do_next () {
                mark_action_done
                make_squash_message $sha1 > "$MSG"
                case "$(peek_next_command)" in
-               squash)
+               squash|s)
                        EDIT_COMMIT=
                        USE_OUTPUT=output
                        cp "$MSG" "$SQUASH_MSG"
@@ -277,9 +276,9 @@ do_next () {
                esac
 
                failed=f
+               author_script=$(get_author_ident_from_commit HEAD)
                output git reset --soft HEAD^
                pick_one -n $sha1 || failed=t
-               author_script=$(get_author_ident_from_commit $sha1)
                echo "$author_script" > "$DOTEST"/author-script
                case $failed in
                f)
@@ -428,7 +427,6 @@ do
 
                require_clean_work_tree
 
-               mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
                if test ! -z "$2"
                then
                        output git show-ref --verify --quiet "refs/heads/$2" ||
@@ -440,6 +438,8 @@ do
                HEAD=$(git rev-parse --verify HEAD) || die "No HEAD?"
                UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
 
+               mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
+
                test -z "$ONTO" && ONTO=$UPSTREAM
 
                : > "$DOTEST"/interactive || die "Could not mark as interactive"