git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ron <ronazek@protonmail.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Git merge should report an actual syntax error when a semicolon is used instead of space for specifying multiple branches
Date: Sat, 13 Apr 2019 00:21:29 +0900	[thread overview]
Message-ID: <xmqqd0lrxn9i.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <NVqJoDneX4bKnXsESFmcKt_7jDQE8Wk9l_F9rkNcnplXgV8TVjfbaMIhKfZ2v9BwJrJ2QJYcq-E6UdshPdhKttO4bIUGdsbs0zZUPNwQvUY=@protonmail.com> (Ron's message of "Fri, 12 Apr 2019 13:37:06 +0000")

Ron <ronazek@protonmail.com> writes:

>> I do not know what "git fetch" uses semicolon for here. Care to
>> elaborate?
>
> Those were all typos, I meant colon, two dots. Sorry.

Do you mean to say that because you can say

	$ git fetch origin +master:refs/remotes/origin/master

you expected that you can say this?

	$ git merge +master:refs/remotes/origin/master

The "git merge" command takes one or more commit-ishes to be merged
to the current branch on its command line, and the above command
line is correct at the syntax level.

But because 'master:refs/remotes/origin/master' does not name a
commit-ish, it is the right thing to barf, saying that it is not
something the command can merge.

If you replace the colon with space, that would mean an entirely
different thing, i.e.

	$ git merge master refs/remotes/origin/master

would mean "I want two commit-ishes, the tip of my 'master' branch,
and the last observed commit at the tip of the 'master' branch at
the 'origin' repository, merged into the branch that is currently
checked out, making an octopus merge".  It also is syntactically
correct, but it may not be what you wanted to do.  Most likely, you
would have rather wanted to do one of these:

	$ git merge refs/remotes/origin/master
	$ git merge origin/master
	$ git merge origin

In any case, because the "what to fetch, followed by where to store
it, separated by a colon, with how to store it optionally signalled
by a leading plus sign" argument syntax used by "git fetch" must
convey a lot more (and different kind of) information than "which
commit to merge to the currently checked-out branch" argument syntax
used by "git merge", these two commands have to take quite different
kind of information and use quite different ways to express these
two kinds of information at the syntax level.  The 'master' on the
left-hand-side of the colon used by "git fetch" does not even name
the 'master' branch _you_ have, while "git merge" that is a totally
local operation only can name a commit-ish object that is locally
available (e.g. a request to merge the 'master' branch you have
would say "git merge master").

      reply	other threads:[~2019-04-12 15:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  1:12 Git merge should report an actual syntax error when a semicolon is used instead of space for specifying multiple branches ron
2019-04-12  7:05 ` Junio C Hamano
2019-04-12 13:37   ` Ron
2019-04-12 15:21     ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd0lrxn9i.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ronazek@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).