All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Daudt <kdaudt@alpinelinux.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Arnaud Bertrand <xda@abalgo.com>, git@vger.kernel.org
Subject: Re: Mismatch meaning between git-diff and git-log for the .. (double dot notation) and ... (triple dot notation)
Date: Mon, 23 Dec 2019 19:29:39 +0100	[thread overview]
Message-ID: <20191223182939.GB676947@alpha> (raw)
In-Reply-To: <xmqqy2v26hu0.fsf@gitster-ct.c.googlers.com>

On Mon, Dec 23, 2019 at 10:02:31AM -0800, Junio C Hamano wrote:
> Please unlearn dot-dot and three-dots when using "git diff", which
> is not about ranges but about comparing two endpoints.  If we were
> reinventing Git today from scratch, we would make "git diff A..B" an
> error.  You can consider it a bug that the command accepts a range
> notation, but this will not change any time soon without a large
> fight to find and fix uses of the syntax in scripts by longtime Git
> users have written over the years.
> 
> Allowing dot-dot on the command line of "git diff", instead of
> diagnosing them as errors and dying, was a stupid mistake we (well,
> mostly Linus, but I am willing to take the blame too) made due to
> laziness when we reused the machinery, which we invented to parse
> the command line of "log" family of commands to specify ranges, to
> parse the command line of "diff", which accidentally ended up
> allowing the syntax for ranges where it shouldn't be allowed.
> 
> And worse yet, since there was only dot-dot and three-dots came much
> later, "git diff A..B" ended up comparing the endpoints A and B,
> because there didn't even A...B notation exist.
> 
> This is not limited to you but any user of modern Git is better off
> to pretend "git diff A..B" does not exist; please unlearn dot-dot
> and three-dots when using "git diff" and you'd be happier.

I agreen that you should not use `A..B`, but what is wrong with
`A...B`? The alternative is a lot more verbose.

git diff $(git merge-base A B) B

Kevin

  reply	other threads:[~2019-12-23 18:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 12:51 Mismatch meaning between git-diff and git-log for the .. (double dot notation) and ... (triple dot notation) Arnaud Bertrand
2019-12-23 18:02 ` Junio C Hamano
2019-12-23 18:29   ` Kevin Daudt [this message]
2019-12-23 21:59     ` Jonathan Nieder
2019-12-23 22:10     ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20191223182939.GB676947@alpha \
    --to=kdaudt@alpinelinux.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=xda@abalgo.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.