From: Junio C Hamano Date: Thu, 11 Jul 2013 20:05:58 +0000 (-0700) Subject: Merge branch 'af/rebase-i-merge-options' X-Git-Tag: v1.8.4-rc0~76 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5b6cd0fe7b876698007c55c577ae2afd49b50c2b?ds=inline;hp=-c Merge branch 'af/rebase-i-merge-options' "git rebase -i" now honors --strategy and -X options. * af/rebase-i-merge-options: Do not ignore merge options in interactive rebase --- 5b6cd0fe7b876698007c55c577ae2afd49b50c2b diff --combined git-rebase--interactive.sh index 169e876eed,ae2da7ac0b..157690b685 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@@ -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 () { @@@ -340,9 -352,8 +352,8 @@@ 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" @@@ -350,7 -361,7 +361,7 @@@ 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 @@@ -713,7 -710,7 +724,7 @@@ 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 @@@ -728,7 -725,7 +739,7 @@@ 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 ;; @@@ -744,8 -741,7 +755,8 @@@ 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"