git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
@ 2020-03-03  7:23 Takuya N via GitGitGadget
  2020-03-03  7:32 ` Bryan Turner
  2020-03-04 12:38 ` [PATCH v2] doc: use 'rev' " Takuya N via GitGitGadget
  0 siblings, 2 replies; 9+ messages in thread
From: Takuya N via GitGitGadget @ 2020-03-03  7:23 UTC (permalink / raw)
  To: git; +Cc: Takuya N, Takuya Noguchi

From: Takuya Noguchi <takninnovationresearch@gmail.com>

The notation <commit> can be misunderstandable only for commit SHA1,
but merge-base accepts any commit references. Like reflog, the name of
arguments should be <ref> instead of <commit>.

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
---
    doc: use 'ref' instead of 'commit' for merge-base arguments
    
    The notation <commit> can be misunderstandable only for commit SHA1, but 
    merge-base accepts any commit references. Like reflog, the name of
    arguments should be <ref> rather than <commit>.
    
    Signed-off-by: Takuya Noguchi takninnovationresearch@gmail.com
    [takninnovationresearch@gmail.com]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-719%2Ftnir%2Fmerge-base-supporting-refs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-719/tnir/merge-base-supporting-refs-v1
Pull-Request: https://github.com/git/git/pull/719

 Documentation/git-merge-base.txt | 10 +++++-----
 builtin/merge-base.c             | 12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 2d944e0851f..b87528ef269 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -9,11 +9,11 @@ git-merge-base - Find as good common ancestors as possible for a merge
 SYNOPSIS
 --------
 [verse]
-'git merge-base' [-a|--all] <commit> <commit>...
-'git merge-base' [-a|--all] --octopus <commit>...
-'git merge-base' --is-ancestor <commit> <commit>
-'git merge-base' --independent <commit>...
-'git merge-base' --fork-point <ref> [<commit>]
+'git merge-base' [-a|--all] <ref> <ref>...
+'git merge-base' [-a|--all] --octopus <ref>...
+'git merge-base' --is-ancestor <ref> <ref>
+'git merge-base' --independent <ref>...
+'git merge-base' --fork-point <ref> [<ref>]
 
 DESCRIPTION
 -----------
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index e3f8da13b69..910916ae0ec 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -29,11 +29,11 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
 }
 
 static const char * const merge_base_usage[] = {
-	N_("git merge-base [-a | --all] <commit> <commit>..."),
-	N_("git merge-base [-a | --all] --octopus <commit>..."),
-	N_("git merge-base --independent <commit>..."),
-	N_("git merge-base --is-ancestor <commit> <commit>"),
-	N_("git merge-base --fork-point <ref> [<commit>]"),
+	N_("git merge-base [-a | --all] <ref> <ref>..."),
+	N_("git merge-base [-a | --all] --octopus <ref>..."),
+	N_("git merge-base --independent <ref>..."),
+	N_("git merge-base --is-ancestor <ref> <ref>"),
+	N_("git merge-base --fork-point <ref1> [<ref2>]"),
 	NULL
 };
 
@@ -158,7 +158,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
 		OPT_CMDMODE(0, "is-ancestor", &cmdmode,
 			    N_("is the first one ancestor of the other?"), 'a'),
 		OPT_CMDMODE(0, "fork-point", &cmdmode,
-			    N_("find where <commit> forked from reflog of <ref>"), 'f'),
+			    N_("find where <ref2> forked from reflog of <ref1>"), 'f'),
 		OPT_END()
 	};
 

base-commit: 2d2118b814c11f509e1aa76cb07110f7231668dc
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
  2020-03-03  7:23 [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments Takuya N via GitGitGadget
@ 2020-03-03  7:32 ` Bryan Turner
  2020-03-03 14:08   ` Johannes Schindelin
  2020-03-04 12:38 ` [PATCH v2] doc: use 'rev' " Takuya N via GitGitGadget
  1 sibling, 1 reply; 9+ messages in thread
From: Bryan Turner @ 2020-03-03  7:32 UTC (permalink / raw)
  To: Takuya N via GitGitGadget; +Cc: Git Users, Takuya Noguchi

On Tue, Mar 3, 2020 at 12:23 AM Takuya N via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Takuya Noguchi <takninnovationresearch@gmail.com>
>
> The notation <commit> can be misunderstandable only for commit SHA1,
> but merge-base accepts any commit references. Like reflog, the name of
> arguments should be <ref> instead of <commit>.

To me, this change goes too far in the opposite direction: Now it
sounds like the command only accepts refs, when it actually accepts
any "commit-ish"--i.e., anything that can be coerced to a commit.
("git worktree" uses this term in its usage for "add", for example.)

At the same time, it doesn't seem like this change goes far enough.
"git merge"'s documentation, for example, is still using "<commit>".
Why is it important that "git merge-base" mention refs, but not that
"git merge" do so?

(Pardon the outburst from the peanut gallery)

>
> Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
> ---
>     doc: use 'ref' instead of 'commit' for merge-base arguments
>
>     The notation <commit> can be misunderstandable only for commit SHA1, but
>     merge-base accepts any commit references. Like reflog, the name of
>     arguments should be <ref> rather than <commit>.
>
>     Signed-off-by: Takuya Noguchi takninnovationresearch@gmail.com
>     [takninnovationresearch@gmail.com]
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-719%2Ftnir%2Fmerge-base-supporting-refs-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-719/tnir/merge-base-supporting-refs-v1
> Pull-Request: https://github.com/git/git/pull/719
>
>  Documentation/git-merge-base.txt | 10 +++++-----
>  builtin/merge-base.c             | 12 ++++++------
>  2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
> index 2d944e0851f..b87528ef269 100644
> --- a/Documentation/git-merge-base.txt
> +++ b/Documentation/git-merge-base.txt
> @@ -9,11 +9,11 @@ git-merge-base - Find as good common ancestors as possible for a merge
>  SYNOPSIS
>  --------
>  [verse]
> -'git merge-base' [-a|--all] <commit> <commit>...
> -'git merge-base' [-a|--all] --octopus <commit>...
> -'git merge-base' --is-ancestor <commit> <commit>
> -'git merge-base' --independent <commit>...
> -'git merge-base' --fork-point <ref> [<commit>]
> +'git merge-base' [-a|--all] <ref> <ref>...
> +'git merge-base' [-a|--all] --octopus <ref>...
> +'git merge-base' --is-ancestor <ref> <ref>
> +'git merge-base' --independent <ref>...
> +'git merge-base' --fork-point <ref> [<ref>]
>
>  DESCRIPTION
>  -----------
> diff --git a/builtin/merge-base.c b/builtin/merge-base.c
> index e3f8da13b69..910916ae0ec 100644
> --- a/builtin/merge-base.c
> +++ b/builtin/merge-base.c
> @@ -29,11 +29,11 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
>  }
>
>  static const char * const merge_base_usage[] = {
> -       N_("git merge-base [-a | --all] <commit> <commit>..."),
> -       N_("git merge-base [-a | --all] --octopus <commit>..."),
> -       N_("git merge-base --independent <commit>..."),
> -       N_("git merge-base --is-ancestor <commit> <commit>"),
> -       N_("git merge-base --fork-point <ref> [<commit>]"),
> +       N_("git merge-base [-a | --all] <ref> <ref>..."),
> +       N_("git merge-base [-a | --all] --octopus <ref>..."),
> +       N_("git merge-base --independent <ref>..."),
> +       N_("git merge-base --is-ancestor <ref> <ref>"),
> +       N_("git merge-base --fork-point <ref1> [<ref2>]"),
>         NULL
>  };
>
> @@ -158,7 +158,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
>                 OPT_CMDMODE(0, "is-ancestor", &cmdmode,
>                             N_("is the first one ancestor of the other?"), 'a'),
>                 OPT_CMDMODE(0, "fork-point", &cmdmode,
> -                           N_("find where <commit> forked from reflog of <ref>"), 'f'),
> +                           N_("find where <ref2> forked from reflog of <ref1>"), 'f'),
>                 OPT_END()
>         };
>
>
> base-commit: 2d2118b814c11f509e1aa76cb07110f7231668dc
> --
> gitgitgadget

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
  2020-03-03  7:32 ` Bryan Turner
@ 2020-03-03 14:08   ` Johannes Schindelin
  2020-03-03 14:30     ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2020-03-03 14:08 UTC (permalink / raw)
  To: Bryan Turner; +Cc: Takuya N via GitGitGadget, Git Users, Takuya Noguchi

Hi,

On Tue, 3 Mar 2020, Bryan Turner wrote:

> On Tue, Mar 3, 2020 at 12:23 AM Takuya N via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > From: Takuya Noguchi <takninnovationresearch@gmail.com>
> >
> > The notation <commit> can be misunderstandable only for commit SHA1,
> > but merge-base accepts any commit references. Like reflog, the name of
> > arguments should be <ref> instead of <commit>.
>
> To me, this change goes too far in the opposite direction: Now it
> sounds like the command only accepts refs, when it actually accepts
> any "commit-ish"--i.e., anything that can be coerced to a commit.
> ("git worktree" uses this term in its usage for "add", for example.)

Maybe we can go for `rev` instead of `ref`?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
  2020-03-03 14:08   ` Johannes Schindelin
@ 2020-03-03 14:30     ` Junio C Hamano
  2020-03-03 19:38       ` Johannes Schindelin
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2020-03-03 14:30 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Bryan Turner, Takuya N via GitGitGadget, Git Users,
	Takuya Noguchi

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > The notation <commit> can be misunderstandable only for commit SHA1,
>> > but merge-base accepts any commit references. Like reflog, the name of
>> > arguments should be <ref> instead of <commit>.
>>
>> To me, this change goes too far in the opposite direction: Now it
>> sounds like the command only accepts refs, when it actually accepts
>> any "commit-ish"--i.e., anything that can be coerced to a commit.
>> ("git worktree" uses this term in its usage for "add", for example.)
>
> Maybe we can go for `rev` instead of `ref`?

That's much better than 'ref', but I do not see why 'commit' is
wrong in the first place.  There are many ways to name an object,
and `rev` is an old colloquial way to say "object name".  Here,
however, we want only commit objects, no?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
  2020-03-03 14:30     ` Junio C Hamano
@ 2020-03-03 19:38       ` Johannes Schindelin
  2020-03-03 20:08         ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2020-03-03 19:38 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Bryan Turner, Takuya N via GitGitGadget, Git Users,
	Takuya Noguchi

Hi,

On Tue, 3 Mar 2020, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> >> > The notation <commit> can be misunderstandable only for commit SHA1,
> >> > but merge-base accepts any commit references. Like reflog, the name of
> >> > arguments should be <ref> instead of <commit>.
> >>
> >> To me, this change goes too far in the opposite direction: Now it
> >> sounds like the command only accepts refs, when it actually accepts
> >> any "commit-ish"--i.e., anything that can be coerced to a commit.
> >> ("git worktree" uses this term in its usage for "add", for example.)
> >
> > Maybe we can go for `rev` instead of `ref`?
>
> That's much better than 'ref', but I do not see why 'commit' is
> wrong in the first place.  There are many ways to name an object,
> and `rev` is an old colloquial way to say "object name".  Here,
> however, we want only commit objects, no?

We do not only want commit objects. It is totally legitimate to ask

	git merge-base HEAD v2.25.0

(v2.25.0 is of course not a commit, it is a tag that _refers_ to a
commit.)

Earlier, we would probably have called this a "commit-ish", but since
users got so confused by this instance of Git Speak (is my interpretation
of the reason, at least), we tend to call them "revs" these days.

I do think that the idea of the patch has merit, even if I agree with
Bryan that we can probably improve on using "ref" instead of "commit".

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments
  2020-03-03 19:38       ` Johannes Schindelin
@ 2020-03-03 20:08         ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2020-03-03 20:08 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Bryan Turner, Takuya N via GitGitGadget, Git Users,
	Takuya Noguchi

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>
> We do not only want commit objects. It is totally legitimate to ask
>
> 	git merge-base HEAD v2.25.0
>
> (v2.25.0 is of course not a commit, it is a tag that _refers_ to a
> commit.)

I meant to say (and was expecting those who know to know)
committish, of course.

> Earlier, we would probably have called this a "commit-ish", but since
> users got so confused by this instance of Git Speak (is my interpretation
> of the reason, at least), we tend to call them "revs" these days.

I am not among that "we".  "rev" is an older and even more nerdy Git
speak that was invented back when Linus was active, and as you can
see, we used the word to mean not just commit or commit-ish, but
anything that can be turned into an object name (you'd realize that
you know it already, when you think about what 'rev' means in "git
rev-parse").  The phrase *-ish came much later (I think I was among
those who started it).


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] doc: use 'rev' instead of 'commit' for merge-base arguments
  2020-03-03  7:23 [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments Takuya N via GitGitGadget
  2020-03-03  7:32 ` Bryan Turner
@ 2020-03-04 12:38 ` Takuya N via GitGitGadget
  2020-03-04 16:44   ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Takuya N via GitGitGadget @ 2020-03-04 12:38 UTC (permalink / raw)
  To: git; +Cc: Takuya N, Takuya Noguchi

From: Takuya Noguchi <takninnovationresearch@gmail.com>

The notation <commit> can be misunderstandable only for commit SHA1,
but merge-base accepts any commit references. Like rev-parse, the name
of arguments should be <rev> instead of <commit>.

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
---
    doc: use 'rev' instead of 'commit' for merge-base arguments
    
    The notation can be misunderstandable only for commit SHA1, but
    merge-base accepts any commit references. Like rev-parse, the name of
    arguments should be instead of .
    
    Changes since v1:
    
     * Use rev instead of ref, not commit-ish which is less used than rev
       through the document.
    
    Signed-off-by: Takuya Noguchi takninnovationresearch@gmail.com
    [takninnovationresearch@gmail.com]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-719%2Ftnir%2Fmerge-base-supporting-refs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-719/tnir/merge-base-supporting-refs-v2
Pull-Request: https://github.com/git/git/pull/719

Range-diff vs v1:

 1:  9c83cf1c620 ! 1:  6e2157da4b1 doc: use 'ref' instead of 'commit' for merge-base arguments
     @@ -1,10 +1,10 @@
      Author: Takuya Noguchi <takninnovationresearch@gmail.com>
      
     -    doc: use 'ref' instead of 'commit' for merge-base arguments
     +    doc: use 'rev' instead of 'commit' for merge-base arguments
      
          The notation <commit> can be misunderstandable only for commit SHA1,
     -    but merge-base accepts any commit references. Like reflog, the name of
     -    arguments should be <ref> instead of <commit>.
     +    but merge-base accepts any commit references. Like rev-parse, the name
     +    of arguments should be <rev> instead of <commit>.
      
          Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
      
     @@ -20,11 +20,11 @@
      -'git merge-base' --is-ancestor <commit> <commit>
      -'git merge-base' --independent <commit>...
      -'git merge-base' --fork-point <ref> [<commit>]
     -+'git merge-base' [-a|--all] <ref> <ref>...
     -+'git merge-base' [-a|--all] --octopus <ref>...
     -+'git merge-base' --is-ancestor <ref> <ref>
     -+'git merge-base' --independent <ref>...
     -+'git merge-base' --fork-point <ref> [<ref>]
     ++'git merge-base' [-a|--all] <rev> <rev>...
     ++'git merge-base' [-a|--all] --octopus <rev>...
     ++'git merge-base' --is-ancestor <rev> <rev>
     ++'git merge-base' --independent <rev>...
     ++'git merge-base' --fork-point <ref> [<rev>]
       
       DESCRIPTION
       -----------
     @@ -41,11 +41,11 @@
      -	N_("git merge-base --independent <commit>..."),
      -	N_("git merge-base --is-ancestor <commit> <commit>"),
      -	N_("git merge-base --fork-point <ref> [<commit>]"),
     -+	N_("git merge-base [-a | --all] <ref> <ref>..."),
     -+	N_("git merge-base [-a | --all] --octopus <ref>..."),
     -+	N_("git merge-base --independent <ref>..."),
     -+	N_("git merge-base --is-ancestor <ref> <ref>"),
     -+	N_("git merge-base --fork-point <ref1> [<ref2>]"),
     ++	N_("git merge-base [-a | --all] <rev> <rev>..."),
     ++	N_("git merge-base [-a | --all] --octopus <rev>..."),
     ++	N_("git merge-base --independent <rev>..."),
     ++	N_("git merge-base --is-ancestor <rev> <rev>"),
     ++	N_("git merge-base --fork-point <ref> [<rev>]"),
       	NULL
       };
       
     @@ -54,7 +54,7 @@
       			    N_("is the first one ancestor of the other?"), 'a'),
       		OPT_CMDMODE(0, "fork-point", &cmdmode,
      -			    N_("find where <commit> forked from reflog of <ref>"), 'f'),
     -+			    N_("find where <ref2> forked from reflog of <ref1>"), 'f'),
     ++			    N_("find where <rev> forked from reflog of <ref>"), 'f'),
       		OPT_END()
       	};
       


 Documentation/git-merge-base.txt | 10 +++++-----
 builtin/merge-base.c             | 12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 2d944e0851f..60438a00871 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -9,11 +9,11 @@ git-merge-base - Find as good common ancestors as possible for a merge
 SYNOPSIS
 --------
 [verse]
-'git merge-base' [-a|--all] <commit> <commit>...
-'git merge-base' [-a|--all] --octopus <commit>...
-'git merge-base' --is-ancestor <commit> <commit>
-'git merge-base' --independent <commit>...
-'git merge-base' --fork-point <ref> [<commit>]
+'git merge-base' [-a|--all] <rev> <rev>...
+'git merge-base' [-a|--all] --octopus <rev>...
+'git merge-base' --is-ancestor <rev> <rev>
+'git merge-base' --independent <rev>...
+'git merge-base' --fork-point <ref> [<rev>]
 
 DESCRIPTION
 -----------
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index e3f8da13b69..e03f2269e88 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -29,11 +29,11 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
 }
 
 static const char * const merge_base_usage[] = {
-	N_("git merge-base [-a | --all] <commit> <commit>..."),
-	N_("git merge-base [-a | --all] --octopus <commit>..."),
-	N_("git merge-base --independent <commit>..."),
-	N_("git merge-base --is-ancestor <commit> <commit>"),
-	N_("git merge-base --fork-point <ref> [<commit>]"),
+	N_("git merge-base [-a | --all] <rev> <rev>..."),
+	N_("git merge-base [-a | --all] --octopus <rev>..."),
+	N_("git merge-base --independent <rev>..."),
+	N_("git merge-base --is-ancestor <rev> <rev>"),
+	N_("git merge-base --fork-point <ref> [<rev>]"),
 	NULL
 };
 
@@ -158,7 +158,7 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
 		OPT_CMDMODE(0, "is-ancestor", &cmdmode,
 			    N_("is the first one ancestor of the other?"), 'a'),
 		OPT_CMDMODE(0, "fork-point", &cmdmode,
-			    N_("find where <commit> forked from reflog of <ref>"), 'f'),
+			    N_("find where <rev> forked from reflog of <ref>"), 'f'),
 		OPT_END()
 	};
 

base-commit: 2f268890c2cd2f115424936bbee27f8269080e5e
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] doc: use 'rev' instead of 'commit' for merge-base arguments
  2020-03-04 12:38 ` [PATCH v2] doc: use 'rev' " Takuya N via GitGitGadget
@ 2020-03-04 16:44   ` Junio C Hamano
  2020-03-04 17:26     ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2020-03-04 16:44 UTC (permalink / raw)
  To: Takuya N via GitGitGadget; +Cc: git, Takuya N

"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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] doc: use 'rev' instead of 'commit' for merge-base arguments
  2020-03-04 16:44   ` Junio C Hamano
@ 2020-03-04 17:26     ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2020-03-04 17:26 UTC (permalink / raw)
  To: Takuya N via GitGitGadget; +Cc: git, Takuya N

Junio C Hamano <gitster@pobox.com> writes:

> ... 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 ...

A side note I forgot to add.  A few commands take both commit and
tag but want to do different things depending on the kind of object
they get, and for them, <commit> and <commit-ish> should be used
carefully in the documentation.

For example, "git cat-file commit v2.25.0" and "git cat-file tag v2.25.0"
do two different things.  They should be described as

	$ git cat-file commit <commit-ish>
	$ git cat-file tag <tag>

"git merge <commit>" and "git merge <tag>" do different
things, even though <tag> must be a <commit-ish>.

But most of the Git subcommands (including the "cat-file commit"
case) peel a tag as needed, so these special cases are minority.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-04 17:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03  7:23 [PATCH] doc: use 'ref' instead of 'commit' for merge-base arguments Takuya N via GitGitGadget
2020-03-03  7:32 ` Bryan Turner
2020-03-03 14:08   ` Johannes Schindelin
2020-03-03 14:30     ` Junio C Hamano
2020-03-03 19:38       ` Johannes Schindelin
2020-03-03 20:08         ` Junio C Hamano
2020-03-04 12:38 ` [PATCH v2] doc: use 'rev' " Takuya N via GitGitGadget
2020-03-04 16:44   ` Junio C Hamano
2020-03-04 17:26     ` Junio C Hamano

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).