summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-25 21:58:45 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-26 10:23:14 -0700
commitbcc3563436526df46cacf2cd627fef5b013eaf03 (patch)
tree7cf2a5103f62f0eb81f21077927a290e49f205e0
parentbca181109d6f054d525c71a84963bbdc1f0c40bf (diff)
downloadgit-jc/merge-deprecate-old-syntax.tar.gz
merge: deprecate 'git merge <message> HEAD <commit>' syntaxjc/merge-deprecate-old-syntax
We had this in "git merge" manual for eternity: 'git merge' <msg> HEAD <commit>... [This] 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>...`. I wanted to see how much damage we would incur to people by checking what the damage to _our_ system, including the test scripts, if we dropped the support for the syntax. The last time I tried this, I thought that replacing the use of this syntax in "git pull" with its obvious and trivial rewrite 'git merge -m <msg> <commit>' broke some output, and that is the primary reason why I stayed away from trying this again, but it no longer seems to be the case with today's code for some reason. There are quite a few fallouts in the test scripts, and it turns out that "git cvsimport" also uses this old syntax to record a merge. Judging from this result, I would not be surprised if dropping the support of the old syntax broke scripts people have written and been relying on for the past ten years. But at least we can start the deprecation process by throwing a warning message when the syntax is used. With luck, we might be able to drop the support in a few years. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/merge.c1
-rwxr-xr-xgit-cvsimport.perl2
-rwxr-xr-xgit-pull.sh2
-rwxr-xr-xt/t3402-rebase-merge.sh2
-rwxr-xr-xt/t6020-merge-df.sh2
-rwxr-xr-xt/t6021-merge-criss-cross.sh6
-rwxr-xr-xt/t9402-git-cvsserver-refs.sh2
7 files changed, 9 insertions, 8 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 3b0f8f96d4..07953585a1 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1182,6 +1182,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (!have_message && head_commit &&
is_old_style_invocation(argc, argv, head_commit->object.sha1)) {
+ warning("old-style 'git merge <msg> HEAD <commit>' is deprecated.");
strbuf_addstr(&merge_msg, argv[0]);
head_arg = argv[1];
argv += 2;
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 73d367cea8..82ecb0343a 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -1162,7 +1162,7 @@ if ($orig_branch) {
die "Fast-forward update failed: $?\n" if $?;
}
else {
- system(qw(git merge cvsimport HEAD), "$remote/$opt_o");
+ system(qw(git merge -m cvsimport), "$remote/$opt_o");
die "Could not merge $opt_o into the current branch.\n" if $?;
}
} else {
diff --git a/git-pull.sh b/git-pull.sh
index 4d4fc77b05..252969e465 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -334,7 +334,7 @@ true)
eval="git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only"
eval="$eval $log_arg $strategy_args $merge_args $verbosity $progress"
eval="$eval $gpg_sign_args"
- eval="$eval \"\$merge_name\" HEAD $merge_head"
+ eval="$eval -m \"\$merge_name\" $merge_head"
;;
esac
eval "exec $eval"
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 5a27ec9b5e..8f64505e4f 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -47,7 +47,7 @@ test_expect_success setup '
'
test_expect_success 'reference merge' '
- git merge -s recursive "reference merge" HEAD master
+ git merge -s recursive -m "reference merge" master
'
PRE_REBASE=$(git rev-parse test-rebase)
diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
index 27c3d73961..2af1beec5f 100755
--- a/t/t6020-merge-df.sh
+++ b/t/t6020-merge-df.sh
@@ -24,7 +24,7 @@ test_expect_success 'prepare repository' '
'
test_expect_success 'Merge with d/f conflicts' '
- test_expect_code 1 git merge "merge msg" B master
+ test_expect_code 1 git merge -m "merge msg" master
'
test_expect_success 'F/D conflict' '
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index d15b313d4b..213deecab1 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -48,7 +48,7 @@ echo "1
" > file &&
git commit -m "C3" file &&
git branch C3 &&
-git merge "pre E3 merge" B A &&
+git merge -m "pre E3 merge" A &&
echo "1
2
3 changed in E3, branch B. New file size
@@ -61,7 +61,7 @@ echo "1
" > file &&
git commit -m "E3" file &&
git checkout A &&
-git merge "pre D8 merge" A C3 &&
+git merge -m "pre D8 merge" C3 &&
echo "1
2
3 changed in C3, branch B
@@ -73,7 +73,7 @@ echo "1
9" > file &&
git commit -m D8 file'
-test_expect_success 'Criss-cross merge' 'git merge "final merge" A B'
+test_expect_success 'Criss-cross merge' 'git merge -m "final merge" B'
cat > file-expect <<EOF
1
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index 1e266effff..d00df08731 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -496,7 +496,7 @@ test_expect_success 'check [cvswork3] diff' '
'
test_expect_success 'merge early [cvswork3] b3 with b1' '
- ( cd gitwork3 && git merge "message" HEAD b1 ) &&
+ ( cd gitwork3 && git merge -m "message" b1 ) &&
git fetch gitwork3 b3:b3 &&
git tag v3merged b3 &&
git push --tags gitcvs.git b3:b3