mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
merge script: --ff-only to disallow true merge
Port v1.6.6-rc0~62^2 (Teach 'git merge' and 'git pull' the option --ff-only, 2009-10-29) to the old merge script. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d9a680acf6
commit
f07df52489
1 changed files with 15 additions and 2 deletions
|
@ -15,6 +15,7 @@ log add list of one-line log to merge commit message
|
||||||
squash create a single commit instead of doing a merge
|
squash create a single commit instead of doing a merge
|
||||||
commit perform a commit if the merge succeeds (default)
|
commit perform a commit if the merge succeeds (default)
|
||||||
ff allow fast-forward (default)
|
ff allow fast-forward (default)
|
||||||
|
ff-only abort if fast-forward is not possible
|
||||||
s,strategy= merge strategy to use
|
s,strategy= merge strategy to use
|
||||||
X= option for selected merge strategy
|
X= option for selected merge strategy
|
||||||
m,message= message to be used for the merge commit (if any)
|
m,message= message to be used for the merge commit (if any)
|
||||||
|
@ -45,6 +46,7 @@ use_strategies=
|
||||||
xopt=
|
xopt=
|
||||||
|
|
||||||
allow_fast_forward=t
|
allow_fast_forward=t
|
||||||
|
fast_forward_only=
|
||||||
allow_trivial_merge=t
|
allow_trivial_merge=t
|
||||||
squash= no_commit= log_arg=
|
squash= no_commit= log_arg=
|
||||||
|
|
||||||
|
@ -189,7 +191,13 @@ parse_config () {
|
||||||
--no-ff)
|
--no-ff)
|
||||||
test "$squash" != t ||
|
test "$squash" != t ||
|
||||||
die "You cannot combine --squash with --no-ff."
|
die "You cannot combine --squash with --no-ff."
|
||||||
|
test "$fast_forward_only" != t ||
|
||||||
|
die "You cannot combine --ff-only with --no-ff."
|
||||||
allow_fast_forward=f ;;
|
allow_fast_forward=f ;;
|
||||||
|
--ff-only)
|
||||||
|
test "$allow_fast_forward" != f ||
|
||||||
|
die "You cannot combine --ff-only with --no-ff."
|
||||||
|
fast_forward_only=t ;;
|
||||||
-s|--strategy)
|
-s|--strategy)
|
||||||
shift
|
shift
|
||||||
case " $all_strategies " in
|
case " $all_strategies " in
|
||||||
|
@ -412,8 +420,8 @@ t,1,"$head",*)
|
||||||
# We are not doing octopus, not fast-forward, and have only
|
# We are not doing octopus, not fast-forward, and have only
|
||||||
# one common.
|
# one common.
|
||||||
git update-index --refresh 2>/dev/null
|
git update-index --refresh 2>/dev/null
|
||||||
case "$allow_trivial_merge" in
|
case "$allow_trivial_merge,$fast_forward_only" in
|
||||||
t)
|
t,)
|
||||||
# See if it is really trivial.
|
# See if it is really trivial.
|
||||||
git var GIT_COMMITTER_IDENT >/dev/null || exit
|
git var GIT_COMMITTER_IDENT >/dev/null || exit
|
||||||
echo "Trying really trivial in-index merge..."
|
echo "Trying really trivial in-index merge..."
|
||||||
|
@ -452,6 +460,11 @@ t,1,"$head",*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if test "$fast_forward_only" = t
|
||||||
|
then
|
||||||
|
die "Not possible to fast-forward, aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
# We are going to make a new commit.
|
# We are going to make a new commit.
|
||||||
git var GIT_COMMITTER_IDENT >/dev/null || exit
|
git var GIT_COMMITTER_IDENT >/dev/null || exit
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue