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

Re: [PATCH] git-diff.txt: prefer not using <commit>..<commit>

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 17, 2019, 13:40 UTC
Message-ID
<87multaaac.fsf@evledraar.gmail.com>
In-Reply-To
<bc7c3f9d769b2d5a108ff4cdc3c7277e112fdb56.1552820745.git.liu.denton@gmail.com>
On Sun, Mar 17 2019, Denton Liu wrote:
Show 46 quoted lines
> The documentation used to consider
>
> 	git diff <commit> <commit>
>
> and
>
> 	git diff <commit>..<commit>
>
> to be equal counterparts. However, rev-list-ish commands also use the
> <commit>..<commit> notation, but in a logically conflicting manner which
> was confusing for some users (including me!).
>
> Deprecating the notation entirely is not really an option because it
> would be an arduous process without much end-value. In addition, there
> are some valid use-cases that we don't want to break.
>
> Document the preference of the first form so that future confusion can
> be minimised.
>
> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>
> Thanks all on your feedback on the discussion thread[1]! I opted for
> just the documentation-only route so we don't break any valid use-cases.
>
> [1]: https://public-inbox.org/git/20190311093751.GA31092@archbookpro.localdomain/
>
>  Documentation/git-diff.txt | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
> index 72179d993c..10c7a2220c 100644
> --- a/Documentation/git-diff.txt
> +++ b/Documentation/git-diff.txt
> @@ -63,7 +63,11 @@ two blob objects, or changes between two files on disk.
>
>  'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
>
> -	This is synonymous to the previous form.  If <commit> on
> +	This is synonymous to the previous form.  However,
> +	users should prefer the previous form over this form
> +	as this form may be more confusing due to the same
> +	notation having a logically conflicting meaning in
> +	linkgit:git-rev-list[1]-ish commands.  If <commit> on
>  	one side is omitted, it will have the same effect as
>  	using HEAD instead.

I think we're better off just consistently recommending "A..B" instead of "A B" and "fixing" any occurrence of the latter to the former. I.e. not taking this patch & going in the other direction.

As noted in the thread you linked we'll always need ".." when one side is "HEAD" implicitly, and that's a really common case.

So as confusing as the whole ".." v.s. "..." is in diff v.s. log I think we're worse off with "A B", since we'll *still* need to document the likes of "A.." and how that differs from log "A.." or "A...".

So sometimes using the whitespace form for two revs and then the ".." when we just have one side makes things more confusing, not less. The reader will be left having to juggle more complexity in their head, not less.

Previous: Johannes SchindelinNext: Duy Nguyen
Message 6 of 16 in “git-diff.txt: prefer not using <commit>..<commit>”
  1. git-diff.txt: prefer not using <commit>..<commit>Denton Liu, Mar 17, 2019
  2. Duy NguyenMar 17, 2019
  3. Junio C HamanoMar 18, 2019
  4. Denton LiuMar 19, 2019
  5. Johannes SchindelinMar 21, 2019
  6. Ævar Arnfjörð BjarmasonMar 17, 2019
  7. Duy NguyenMar 17, 2019
  8. Ævar Arnfjörð BjarmasonMar 17, 2019
  9. Junio C HamanoMar 18, 2019
  10. Elijah NewrenMar 18, 2019
  11. Ævar Arnfjörð BjarmasonMar 18, 2019
  12. Junio C HamanoMar 19, 2019
  13. Elijah NewrenMar 20, 2019
  14. Elijah NewrenMar 18, 2019
  15. Denton LiuMar 20, 2019
  16. Elijah NewrenMar 21, 2019

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.