Merge branch 'af/rebase-i-merge-options'
authorJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2013 20:05:58 +0000 (13:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2013 20:05:59 +0000 (13:05 -0700)
"git rebase -i" now honors --strategy and -X options.

* af/rebase-i-merge-options:
Do not ignore merge options in interactive rebase

1  2 
git-rebase--interactive.sh
index 169e876eedac48f6367ea3ea3178c01e45cc0560,ae2da7ac0bd4c6b0f3e5a321d88f7412d5c1424c..157690b6858bdd8497be0bcea6f2385d86dc3f33
@@@ -80,6 -80,18 +80,18 @@@ amend="$state_dir"/amen
  rewritten_list="$state_dir"/rewritten-list
  rewritten_pending="$state_dir"/rewritten-pending
  
+ 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
  GIT_CHERRY_PICK_HELP="$resolvemsg"
  export GIT_CHERRY_PICK_HELP
  
@@@ -239,7 -251,7 +251,7 @@@ pick_one () 
  
        test -d "$rewritten" &&
                pick_one_preserving_merges "$@" && return
-       output git cherry-pick $empty_args $ff "$@"
+       output eval git cherry-pick "$strategy_args" $empty_args $ff "$@"
  }
  
  pick_one_preserving_merges () {
                        msg_content="$(commit_message $sha1)"
                        # No point in merging the first parent, that's HEAD
                        new_parents=${new_parents# $first_parent}
-                       if ! do_with_author output \
-                               git merge --no-ff ${strategy:+-s $strategy} -m \
-                                       "$msg_content" $new_parents
+                       if ! do_with_author output eval \
+                       'git merge --no-ff $strategy_args -m "$msg_content" $new_parents'
                        then
                                printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
                                die_with_patch $sha1 "Error redoing merge $sha1"
                        echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list"
                        ;;
                *)
-                       output git cherry-pick "$@" ||
+                       output eval git cherry-pick "$strategy_args" "$@" ||
                                die_with_patch $sha1 "Could not pick $sha1"
                        ;;
                esac
@@@ -689,22 -700,8 +700,22 @@@ rearrange_squash () 
                case "$message" in
                "squash! "*|"fixup! "*)
                        action="${message%%!*}"
 -                      rest="${message#*! }"
 -                      echo "$sha1 $action $rest"
 +                      rest=$message
 +                      prefix=
 +                      # skip all squash! or fixup! (but save for later)
 +                      while :
 +                      do
 +                              case "$rest" in
 +                              "squash! "*|"fixup! "*)
 +                                      prefix="$prefix${rest%%!*},"
 +                                      rest="${rest#*! }"
 +                                      ;;
 +                              *)
 +                                      break
 +                                      ;;
 +                              esac
 +                      done
 +                      echo "$sha1 $action $prefix $rest"
                        # if it's a single word, try to resolve to a full sha1 and
                        # emit a second copy. This allows us to match on both message
                        # and on sha1 prefix
                                if test -n "$fullsha"; then
                                        # prefix the action to uniquely identify this line as
                                        # intended for full sha1 match
 -                                      echo "$sha1 +$action $fullsha"
 +                                      echo "$sha1 +$action $prefix $fullsha"
                                fi
                        fi
                esac
                esac
                printf '%s\n' "$pick $sha1 $message"
                used="$used$sha1 "
 -              while read -r squash action msg_content
 +              while read -r squash action msg_prefix msg_content
                do
                        case " $used" in
                        *" $squash "*) continue ;;
                                case "$message" in "$msg_content"*) emit=1;; esac ;;
                        esac
                        if test $emit = 1; then
 -                              printf '%s\n' "$action $squash $action! $msg_content"
 +                              real_prefix=$(echo "$msg_prefix" | sed "s/,/! /g")
 +                              printf '%s\n' "$action $squash ${real_prefix}$msg_content"
                                used="$used$squash "
                        fi
                done <"$1.sq"