Fabian Ruch <[email protected]> writes:

> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
> index d3fb67d..3f754ae 100644
> --- a/git-rebase--merge.sh
> +++ b/git-rebase--merge.sh
> @@ -67,7 +67,13 @@ call_merge () {
>               GIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY
>       fi
>       test -z "$strategy" && strategy=recursive
> -     eval 'git-merge-$strategy' $strategy_opts '"$cmt^" -- "$hd" "$cmt"'
> +     base=$(git rev-list --parents -1 $cmt | cut -d ' ' -s -f 2 -)
> +     if test -z "$base"
> +     then
> +             # the empty tree sha1
> +             base=4b825dc642cb6eb9a060e54bf8d69288fbee4904
> +     fi
> +     eval 'git-merge-$strategy' $strategy_opts '"$base" -- "$hd" "$cmt"'

This looks wrong.

The interface to "git-merge-$strategy" is designed in such a way
that each strategy should be capable of taking _no_ base at all.

See how unquoted $common is given to git-merge-$strategy in
contrib/examples/git-merge.sh, i.e.

    eval 'git-merge-$strategy '"$xopt"' $common -- "$head_arg" "$@"'

where common comes from

        common=$(git merge-base ...)

which would be empty when you are looking at disjoint histories.

Also rev-list piped to cut is too ugly to live in our codebase X-<.

Wouldn't it be sufficient to do something like this instead?

        eval 'git-merge-$strategy' $strategy_opts \
                $(git rev-parse --quiet --verify "$cmt^") -- "$hd" "$cmt"

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to