diff options
-rw-r--r-- | Documentation/git-merge.txt | 7 | ||||
-rw-r--r-- | builtin/merge.c | 59 |
2 files changed, 10 insertions, 56 deletions
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index ca3c27b88a..04fdd8cf08 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -13,7 +13,6 @@ SYNOPSIS [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]] [--[no-]allow-unrelated-histories] [--[no-]rerere-autoupdate] [-m <msg>] [<commit>...] -'git merge' <msg> HEAD <commit>... 'git merge' --abort 'git merge' --continue @@ -46,11 +45,7 @@ a log message from the user describing the changes. D---E---F---G---H master ------------ -The second syntax (<msg> `HEAD` <commit>...) is supported for -historical reasons. Do not use it from the command line or in -new scripts. It is the same as `git merge -m <msg> <commit>...`. - -The third syntax ("`git merge --abort`") can only be run after the +The second syntax ("`git merge --abort`") can only be run after the merge has resulted in conflicts. 'git merge --abort' will abort the merge process and try to reconstruct the pre-merge state. However, if there were uncommitted changes when the merge started (and diff --git a/builtin/merge.c b/builtin/merge.c index 7554b8d412..95572b1810 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -44,7 +44,6 @@ struct strategy { static const char * const builtin_merge_usage[] = { N_("git merge [<options>] [<commit>...]"), - N_("git merge [<options>] <msg> HEAD <commit>"), N_("git merge --abort"), N_("git merge --continue"), NULL @@ -634,9 +633,10 @@ static void write_tree_trivial(struct object_id *oid) static int try_merge_strategy(const char *strategy, struct commit_list *common, struct commit_list *remoteheads, - struct commit *head, const char *head_arg) + struct commit *head) { static struct lock_file lock; + const char *head_arg = "HEAD"; hold_locked_index(&lock, LOCK_DIE_ON_ERROR); refresh_cache(REFRESH_QUIET); @@ -853,24 +853,6 @@ static int suggest_conflicts(void) return 1; } -static struct commit *is_old_style_invocation(int argc, const char **argv, - const struct object_id *head) -{ - struct commit *second_token = NULL; - if (argc > 2) { - struct object_id second_oid; - - if (get_oid(argv[1], &second_oid)) - return NULL; - second_token = lookup_commit_reference_gently(second_oid.hash, 0); - if (!second_token) - die(_("'%s' is not a commit"), argv[1]); - if (oidcmp(&second_token->object.oid, head)) - return NULL; - } - return second_token; -} - static int evaluate_result(void) { int cnt = 0; @@ -1120,7 +1102,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix) struct object_id result_tree, stash, head_oid; struct commit *head_commit; struct strbuf buf = STRBUF_INIT; - const char *head_arg; int i, ret = 0, head_subsumed; int best_cnt = -1, merge_was_ok = 0, automerge_was_ok = 0; struct commit_list *common = NULL; @@ -1260,34 +1241,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix) } /* - * This could be traditional "merge <msg> HEAD <commit>..." and - * the way we can tell it is to see if the second token is HEAD, - * but some people might have misused the interface and used a - * commit-ish that is the same as HEAD there instead. - * Traditional format never would have "-m" so it is an - * additional safety measure to check for it. + * All the rest are the commits being merged; prepare + * the standard merge summary message to be appended + * to the given message. */ - if (!have_message && - is_old_style_invocation(argc, argv, &head_commit->object.oid)) { - warning("old-style 'git merge <msg> HEAD <commit>' is deprecated."); - strbuf_addstr(&merge_msg, argv[0]); - head_arg = argv[1]; - argv += 2; - argc -= 2; - remoteheads = collect_parents(head_commit, &head_subsumed, - argc, argv, NULL); - } else { - /* We are invoked directly as the first-class UI. */ - head_arg = "HEAD"; - - /* - * All the rest are the commits being merged; prepare - * the standard merge summary message to be appended - * to the given message. - */ - remoteheads = collect_parents(head_commit, &head_subsumed, - argc, argv, &merge_msg); - } + remoteheads = collect_parents(head_commit, &head_subsumed, + argc, argv, &merge_msg); if (!head_commit || !argc) usage_with_options(builtin_merge_usage, @@ -1513,7 +1472,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) ret = try_merge_strategy(use_strategies[i]->name, common, remoteheads, - head_commit, head_arg); + head_commit); if (!option_commit && !ret) { merge_was_ok = 1; /* @@ -1583,7 +1542,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) printf(_("Using the %s to prepare resolving by hand.\n"), best_strategy); try_merge_strategy(best_strategy, common, remoteheads, - head_commit, head_arg); + head_commit); } if (squash) |