git-merge: add support for branch.<name>.mergeoptions

This enables per branch configuration of merge options. Currently, the most
useful options to specify per branch are --squash, --summary/--no-summary
and possibly --strategy, but all options are supported.

Note: Options containing whitespace will _not_ be handled correctly. Luckily,
the only option which can include whitespace is --message and it doesn't
make much sense to give that option a default value.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Lars Hjemli
2007-09-24 00:51:43 +02:00
committed by Junio C Hamano
parent d38eb710d9
commit aec7b362ad
4 changed files with 85 additions and 0 deletions

View File

@ -168,9 +168,30 @@ parse_option () {
args_left=$#
}
parse_config () {
while test $# -gt 0
do
parse_option "$@" || usage
while test $args_left -lt $#
do
shift
done
done
}
test $# != 0 || usage
have_message=
if branch=$(git-symbolic-ref -q HEAD)
then
mergeopts=$(git config "branch.${branch#refs/heads/}.mergeoptions")
if test -n "$mergeopts"
then
parse_config $mergeopts
fi
fi
while parse_option "$@"
do
while test $args_left -lt $#