Code

i18n: git-submodule "cached cannot be used" message
[git.git] / git-rebase--interactive.sh
old mode 100755 (executable)
new mode 100644 (file)
index fa8bfda..41ba96a
@@ -86,20 +86,6 @@ warn () {
        printf '%s\n' "$*" >&2
 }
 
-output () {
-       case "$verbose" in
-       '')
-               output=$("$@" 2>&1 )
-               status=$?
-               test $status != 0 && printf "%s\n" "$output"
-               return $status
-               ;;
-       *)
-               "$@"
-               ;;
-       esac
-}
-
 # Output the commit message for the specified commit.
 commit_message () {
        git cat-file commit "$1" | sed "1,/^$/d"
@@ -182,11 +168,6 @@ pick_one () {
        output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
        test -d "$rewritten" &&
                pick_one_preserving_merges "$@" && return
-       if test -n "$rebase_root"
-       then
-               output git cherry-pick "$@"
-               return
-       fi
        output git cherry-pick $ff "$@"
 }
 
@@ -289,7 +270,7 @@ pick_one_preserving_merges () {
                        # No point in merging the first parent, that's HEAD
                        new_parents=${new_parents# $first_parent}
                        if ! do_with_author output \
-                               git merge ${strategy:+-s $strategy} -m \
+                               git merge --no-ff ${strategy:+-s $strategy} -m \
                                        "$msg_content" $new_parents
                        then
                                printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
@@ -523,9 +504,7 @@ do_next () {
        test -s "$todo" && return
 
        comment_for_reflog finish &&
-       head_name=$(cat "$state_dir"/head-name) &&
-       orig_head=$(cat "$state_dir"/head) &&
-       shortonto=$(git rev-parse --short $(cat "$state_dir"/onto)) &&
+       shortonto=$(git rev-parse --short $onto) &&
        newhead=$(git rev-parse HEAD) &&
        case $head_name in
        refs/*)
@@ -535,7 +514,7 @@ do_next () {
                ;;
        esac && {
                test ! -f "$state_dir"/verbose ||
-                       git diff-tree --stat $(cat "$state_dir"/head)..HEAD
+                       git diff-tree --stat $orig_head..HEAD
        } &&
        {
                test -s "$rewritten_list" &&
@@ -598,13 +577,6 @@ skip_unnecessary_picks () {
        die "Could not skip unnecessary pick commands"
 }
 
-get_saved_options () {
-       test -d "$rewritten" && preserve_merges=t
-       test -f "$state_dir"/strategy && strategy="$(cat "$state_dir"/strategy)"
-       test -f "$state_dir"/verbose && verbose=t
-       test -f "$state_dir"/rebase-root && rebase_root=t
-}
-
 # Rearrange the todo list that has both "pick sha1 msg" and
 # "pick sha1 fixup!/squash! msg" appears in it so that the latter
 # comes immediately after the former, and change "pick" to
@@ -668,16 +640,6 @@ rearrange_squash () {
 
 case "$action" in
 continue)
-       get_saved_options
-       comment_for_reflog continue
-
-       # Sanity check
-       git rev-parse --verify HEAD >/dev/null ||
-               die "Cannot read HEAD"
-       git update-index --ignore-submodules --refresh &&
-               git diff-files --quiet --ignore-submodules ||
-               die "Working tree is dirty"
-
        # do we have anything to commit?
        if git diff-index --cached --quiet --ignore-submodules HEAD --
        then
@@ -707,30 +669,10 @@ first and then run 'git rebase --continue' again."
        require_clean_work_tree "rebase"
        do_rest
        ;;
-abort)
-       get_saved_options
-       comment_for_reflog abort
-
-       git rerere clear
-
-       head_name=$(cat "$state_dir"/head-name)
-       orig_head=$(cat "$state_dir"/head)
-       case $head_name in
-       refs/*)
-               git symbolic-ref HEAD $head_name
-               ;;
-       esac &&
-       output git reset --hard $orig_head &&
-       rm -rf "$state_dir"
-       exit
-       ;;
 skip)
-       get_saved_options
-       comment_for_reflog skip
-
        git rerere clear
 
-       output git reset --hard && do_rest
+       do_rest
        ;;
 esac
 
@@ -749,18 +691,7 @@ orig_head=$(git rev-parse --verify HEAD) || die "No HEAD?"
 mkdir "$state_dir" || die "Could not create temporary $state_dir"
 
 : > "$state_dir"/interactive || die "Could not mark as interactive"
-echo "$head_name" > "$state_dir"/head-name
-
-echo $orig_head > "$state_dir"/head
-case "$rebase_root" in
-'')
-       rm -f "$state_dir"/rebase-root ;;
-*)
-       : >"$state_dir"/rebase-root ;;
-esac
-echo $onto > "$state_dir"/onto
-test -z "$strategy" || echo "$strategy" > "$state_dir"/strategy
-test t = "$verbose" && : > "$state_dir"/verbose
+write_basic_state
 if test t = "$preserve_merges"
 then
        if test -z "$rebase_root"