cherry-pick/revert: add support for -X/--strategy-option
For example, this would allow cherry-picking or reverting patches from a piece of history with a different end-of-line style, like so: $ git revert -Xrenormalize old-problematic-commit Currently that is possible with manual use of merge-recursive but the cherry-pick/revert porcelain does not expose the functionality. While at it, document the existing support for --strategy. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
73e7b2ef6c
commit
67ac1e1d57
@ -26,6 +26,7 @@ require_work_tree
|
||||
cd_to_toplevel
|
||||
|
||||
no_commit=
|
||||
xopt=
|
||||
while case "$#" in 0) break ;; esac
|
||||
do
|
||||
case "$1" in
|
||||
@ -44,6 +45,16 @@ do
|
||||
-x|--i-really-want-to-expose-my-private-commit-object-name)
|
||||
replay=
|
||||
;;
|
||||
-X?*)
|
||||
xopt="$xopt$(git rev-parse --sq-quote "--${1#-X}")"
|
||||
;;
|
||||
--strategy-option=*)
|
||||
xopt="$xopt$(git rev-parse --sq-quote "--${1#--strategy-option=}")"
|
||||
;;
|
||||
-X|--strategy-option)
|
||||
shift
|
||||
xopt="$xopt$(git rev-parse --sq-quote "--$1")"
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
@ -159,7 +170,7 @@ export GITHEAD_$head GITHEAD_$next
|
||||
# and $prev on top of us (when reverting), or the change between
|
||||
# $prev and $commit on top of us (when cherry-picking or replaying).
|
||||
|
||||
git-merge-recursive $base -- $head $next &&
|
||||
eval "git merge-recursive $xopt $base -- $head $next" &&
|
||||
result=$(git-write-tree 2>/dev/null) || {
|
||||
mv -f .msg "$GIT_DIR/MERGE_MSG"
|
||||
{
|
||||
|
Reference in New Issue
Block a user