Merge branch 'fc/status-printf-squelch-format-zero-length-warnings'
[gitweb.git] / contrib / examples / git-revert.sh
index 49f00321b28833c24ebb78ea2104f34091d43017..7e2aad549103c0c2cdaa452a60a16706f0c7e117 100755 (executable)
@@ -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
                ;;
@@ -126,7 +137,7 @@ cherry-pick)
                q
        }'
 
-       logmsg=`git show -s --pretty=raw --encoding="$encoding" "$commit"`
+       logmsg=$(git show -s --pretty=raw --encoding="$encoding" "$commit")
        set_author_env=`echo "$logmsg" |
        LANG=C LC_ALL=C sed -ne "$pick_author_script"`
        eval "$set_author_env"
@@ -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"
        {
@@ -181,7 +192,6 @@ Conflicts:
        esac
        exit 1
 }
-echo >&2 "Finished one $me."
 
 # If we are cherry-pick, and if the merge did not result in
 # hand-editing, we will hit this commit and inherit the original