git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] merge: deprecate 'git merge <message> HEAD <commit>' syntax

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 26, 2015, 13:51 UTC
Message-ID
<CAPig+cR6CiEgQzmXS2w7XLfNWpm=vD-kTu5NmyLBLT3z=JAkAg@mail.gmail.com>
In-Reply-To
<xmqqvbhoz75m.fsf@gitster.dls.corp.google.com>
On Thu, Mar 26, 2015 at 12:58 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 39 quoted lines
> 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>
> ---
> diff --git a/builtin/merge.c b/builtin/merge.c
> index 3b0f8f9..0795358 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.");

To be a bit more helpful, perhaps point the user at "git merge -m <msg> <commit>..." as the recommended replacement?

>                 strbuf_addstr(&merge_msg, argv[0]);
>                 head_arg = argv[1];
>                 argv += 2;
Previous: Jeff King
Message 4 of 4 in “merge: deprecate 'git merge <message> HEAD <commit>' syntax”
  1. merge: deprecate 'git merge <message> HEAD <commit>' syntaxJunio C Hamano, Mar 26, 2015
  2. merge: drop 'git merge <message> HEAD <commit>' syntaxJunio C Hamano, Mar 26, 2015
  3. Jeff KingMar 26, 2015
  4. Eric SunshineMar 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.