diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-11-10 12:32:59 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-10 12:32:59 -0800 |
commit | 3cc335181fdeba6cb25e9a6e55217b2e8d18e6b1 (patch) | |
tree | 42fc1b67e7237c5c3913004c53bc8c14dea479c8 /builtin-merge.c | |
parent | 740b6ad75bbe0cd0c3f4be30f0380814878ac445 (diff) | |
parent | 134748353b2a71a34f899c9b1326ccf7ae082412 (diff) | |
download | git-3cc335181fdeba6cb25e9a6e55217b2e8d18e6b1.tar.gz |
Merge branch 'bg/merge-ff-only'
* bg/merge-ff-only:
Teach 'git merge' and 'git pull' the option --ff-only
Diffstat (limited to 'builtin-merge.c')
-rw-r--r-- | builtin-merge.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin-merge.c b/builtin-merge.c index c69a3051f3..1ff7b15803 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -43,6 +43,7 @@ static const char * const builtin_merge_usage[] = { static int show_diffstat = 1, option_log, squash; static int option_commit = 1, allow_fast_forward = 1; +static int fast_forward_only; static int allow_trivial = 1, have_message; static struct strbuf merge_msg; static struct commit_list *remoteheads; @@ -167,6 +168,8 @@ static struct option builtin_merge_options[] = { "perform a commit if the merge succeeds (default)"), OPT_BOOLEAN(0, "ff", &allow_fast_forward, "allow fast forward (default)"), + OPT_BOOLEAN(0, "ff-only", &fast_forward_only, + "abort if fast forward is not possible"), OPT_CALLBACK('s', "strategy", &use_strategies, "strategy", "merge strategy to use", option_parse_strategy), OPT_CALLBACK('m', "message", &merge_msg, "message", @@ -877,6 +880,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix) option_commit = 0; } + if (!allow_fast_forward && fast_forward_only) + die("You cannot combine --no-ff with --ff-only."); + if (!argc) usage_with_options(builtin_merge_usage, builtin_merge_options); @@ -1043,7 +1049,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) * only one common. */ refresh_cache(REFRESH_QUIET); - if (allow_trivial) { + if (allow_trivial && !fast_forward_only) { /* See if it is really trivial. */ git_committer_info(IDENT_ERROR_ON_NO_NAME); printf("Trying really trivial in-index merge...\n"); @@ -1082,6 +1088,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix) } } + if (fast_forward_only) + die("Not possible to fast forward, aborting."); + /* We are going to make a new commit. */ git_committer_info(IDENT_ERROR_ON_NO_NAME); |