merge: drop 'git merge <message> HEAD <commit>' syntax
And then if we and our users survived the previous "start warning if the old syntax is used" patch for a few years, we could apply this to actually drop the support for the ancient syntax. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 25, 2015 at 22:00 UTC
b4391657ed96c8dd2881d5c9fcad39a07d8cb92a
2 files changed
+10
-56
Documentation/git-merge.txt
+1
-6
@@ -12,7 +12,6 @@ SYNOPSIS
12
'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
13
[-s <strategy>] [-X <strategy-option>] [-S[<key-id>]]
14
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
15
-'git merge' <msg> HEAD <commit>...
15
'git merge' --abort
16
17
DESCRIPTION
@@ -44,11 +43,7 @@ a log message from the user describing the changes.
43
D---E---F---G---H master
44
------------
45
47
-The second syntax (<msg> `HEAD` <commit>...) is supported for
48
-historical reasons. Do not use it from the command line or in
49
-new scripts. It is the same as `git merge -m <msg> <commit>...`.
50
-
51
-The third syntax ("`git merge --abort`") can only be run after the
46
+The second syntax ("`git merge --abort`") can only be run after the
47
merge has resulted in conflicts. 'git merge --abort' will abort the
48
merge process and try to reconstruct the pre-merge state. However,
49
if there were uncommitted changes when the merge started (and
builtin/merge.c
+9
-50
@@ -42,7 +42,6 @@ struct strategy {
42
43
static const char * const builtin_merge_usage[] = {
44
N_("git merge [options] [<commit>...]"),
45
- N_("git merge [options] <msg> HEAD <commit>"),
45
N_("git merge --abort"),
46
NULL
47
};
@@ -633,9 +632,10 @@ static void write_tree_trivial(unsigned char *sha1)
632
633
static int try_merge_strategy(const char *strategy, struct commit_list *common,
634
struct commit_list *remoteheads,
636
- struct commit *head, const char *head_arg)
635
+ struct commit *head)
636
{
637
static struct lock_file lock;
638
+ const char *head_arg = "HEAD";
639
640
hold_locked_index(&lock, 1);
641
refresh_cache(REFRESH_QUIET);
@@ -887,24 +887,6 @@ static int suggest_conflicts(int renormalizing)
887
return 1;
888
}
889
890
-static struct commit *is_old_style_invocation(int argc, const char **argv,
891
- const unsigned char *head)
892
-{
893
- struct commit *second_token = NULL;
894
- if (argc > 2) {
895
- unsigned char second_sha1[20];
896
-
897
- if (get_sha1(argv[1], second_sha1))
898
- return NULL;
899
- second_token = lookup_commit_reference_gently(second_sha1, 0);
900
- if (!second_token)
901
- die(_("'%s' is not a commit"), argv[1]);
902
- if (hashcmp(second_token->object.sha1, head))
903
- return NULL;
904
- }
905
- return second_token;
906
-}
907
-
890
static int evaluate_result(void)
891
{
892
int cnt = 0;
@@ -1172,7 +1154,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1154
unsigned char head_sha1[20];
1155
struct commit *head_commit;
1156
struct strbuf buf = STRBUF_INIT;
1175
- const char *head_arg;
1157
int flag, i, ret = 0, head_subsumed;
1158
int best_cnt = -1, merge_was_ok = 0, automerge_was_ok = 0;
1159
struct commit_list *common = NULL;
@@ -1290,34 +1271,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1271
}
1272
1273
/*
1293
- * This could be traditional "merge <msg> HEAD <commit>..." and
1294
- * the way we can tell it is to see if the second token is HEAD,
1295
- * but some people might have misused the interface and used a
1296
- * commit-ish that is the same as HEAD there instead.
1297
- * Traditional format never would have "-m" so it is an
1298
- * additional safety measure to check for it.
1274
+ * All the rest are the commits being merged; prepare
1275
+ * the standard merge summary message to be appended
1276
+ * to the given message.
1277
*/
1300
- if (!have_message &&
1301
- is_old_style_invocation(argc, argv, head_commit->object.sha1)) {
1302
- warning("old-style 'git merge <msg> HEAD <commit>' is deprecated.");
1303
- strbuf_addstr(&merge_msg, argv[0]);
1304
- head_arg = argv[1];
1305
- argv += 2;
1306
- argc -= 2;
1307
- remoteheads = collect_parents(head_commit, &head_subsumed,
1308
- argc, argv, NULL);
1309
- } else {
1310
- /* We are invoked directly as the first-class UI. */
1311
- head_arg = "HEAD";
1312
-
1313
- /*
1314
- * All the rest are the commits being merged; prepare
1315
- * the standard merge summary message to be appended
1316
- * to the given message.
1317
- */
1318
- remoteheads = collect_parents(head_commit, &head_subsumed,
1319
- argc, argv, &merge_msg);
1320
- }
1278
+ remoteheads = collect_parents(head_commit, &head_subsumed,
1279
+ argc, argv, &merge_msg);
1280
1281
if (!head_commit || !argc)
1282
usage_with_options(builtin_merge_usage,
@@ -1542,7 +1501,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1501
1502
ret = try_merge_strategy(use_strategies[i]->name,
1503
common, remoteheads,
1545
- head_commit, head_arg);
1504
+ head_commit);
1505
if (!option_commit && !ret) {
1506
merge_was_ok = 1;
1507
/*
@@ -1612,7 +1571,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1571
printf(_("Using the %s to prepare resolving by hand.\n"),
1572
best_strategy);
1573
try_merge_strategy(best_strategy, common, remoteheads,
1615
- head_commit, head_arg);
1574
+ head_commit);
1575
}
1576
1577
if (squash)