Skip to content

Commit b81e00a

Browse files
committed
git-merge: a deprecation notice of the ancient command line syntax
The ancient form of git merge command used in the original sample script has been copied from Linus and are still found everywhere, I think, and people may still have it in their scripts, but on the other hand, it is so unintuitive that even people reasonably familiar with git are surprised by accidentally triggering the support to parse this ancient form. Gently nudge people to upgrade their script to more recent and readable style for eventual removal of the original syntax. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 78d553b commit b81e00a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

builtin-merge.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,11 @@ static int suggest_conflicts(void)
789789
return 1;
790790
}
791791

792+
static const char deprecation_warning[] =
793+
"'git merge <msg> HEAD <commit>' is deprecated. Please update\n"
794+
"your script to use 'git merge -m <msg> <commit>' instead.\n"
795+
"In future versions of git, this syntax will be removed.";
796+
792797
static struct commit *is_old_style_invocation(int argc, const char **argv)
793798
{
794799
struct commit *second_token = NULL;
@@ -802,6 +807,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv)
802807
die("'%s' is not a commit", argv[1]);
803808
if (hashcmp(second_token->object.sha1, head))
804809
return NULL;
810+
warning(deprecation_warning);
805811
}
806812
return second_token;
807813
}

0 commit comments

Comments
 (0)