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

Re: [PATCH v2] doc: use 'rev' instead of 'commit' for merge-base arguments

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 4, 2020, 16:44 UTC
Message-ID
<xmqqd09s5atg.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<pull.719.v2.git.git.1583325514607.gitgitgadget@gmail.com>
"Takuya N via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Takuya Noguchi <takninnovationresearch@gmail.com>
>
> The notation <commit> can be misunderstandable only for commit SHA1,
Let's step back a bit.  When our documentation says
    $ git log <commit>

we expect that the readers to understand that all of the following are accepted:

    $ git log master
    $ git log master~10
    $ git log 3868ac720f
    $ git log 3868ac720f7a26f3241f43764d0dc790ec55238f

What gave you the impression that only the last one is valid? We need to fix _that_.

The side discussion we had with Dscho touched another important point (i.e. when a command wants to take a commit but a user gives it a tag that points at a commit, the command almost always accepts the tag, finds the commit the tag points at, and uses that commit instead of the tag---we often mark such a parameter that expects commit but does not have to name a commit object <commit-ish>), but it is more or less orthogonal. All of these are accepted,

    $ git log v2.25.0
    $ git log 61e952148
    $ git log 61e9521487999585dc2b8f27c2a65226fb531a07
not just the last one.
> but merge-base accepts any commit references. Like rev-parse, the name
> of arguments should be <rev> instead of <commit>.

And "like rev-parse" is a poor justification. It is a lowest-level command that was written in dark ages, and the language used in the documentation hasn't been updated to more modern terms. Back then, we said "revision" (and "rev" is a short for it) and the term was invented to mean commit (see "$ git help glossary") but was used loosely and more-or-less interchangeably with "object name" (in other words, when the speaker who said "rev" did not necessarily mean to limit the reference to commits, the word did not limit itself to commit-ish but also covered trees and blobs).

Now, in the context of "git rev-parse",
    $ git rev-parse eacd13fab7e3

does make sense. It is OK to give it a short version of a tree object name (it is the tree of the commit pointed by the v2.25.0 release), so "git rev-parse <object-name>" (or "git rev-parse <rev>") would be OK.

It is however a poor example to base our decision on how to explain merge-base. The command wants to _use_ two (or more) commits to work on, so like many other commands, when it is fed a tag, it tries to see if it points at a commit (and barfs if it does not) and use that commit instead. In other words, it takes commit-ish.

Saying that it takes <commit> is *not* so bad, but changing it to <rev> is a move backwards, I'd have to say.

Thanks for working on it, but s/ref/rev/ is not a good change.
Previous: Takuya N via GitGitGadgetNext: Junio C Hamano
Message 8 of 9 in “doc: use 'ref' instead of 'commit' for merge-base arguments”
  1. doc: use 'ref' instead of 'commit' for merge-base argumentsTakuya N via GitGitGadget, Mar 3, 2020
  2. Bryan TurnerMar 3, 2020
  3. Johannes SchindelinMar 3, 2020
  4. Junio C HamanoMar 3, 2020
  5. Johannes SchindelinMar 3, 2020
  6. Junio C HamanoMar 3, 2020
  7. doc: use 'rev' instead of 'commit' for merge-base argumentsTakuya N via GitGitGadget, Mar 4, 2020
  8. Junio C HamanoMar 4, 2020
  9. Junio C HamanoMar 4, 2020

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.