From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH] Documentation/git-diff: document git diff with 3+ commits
Date: Thu, 27 Oct 2016 11:27:14 +0200 [thread overview]
Message-ID: <e74d4d84-d848-00be-8ca5-75204cf47262@drmicha.warpmail.net> (raw)
In-Reply-To: <xmqqh97zask7.fsf@gitster.mtv.corp.google.com>
Junio C Hamano venit, vidit, dixit 26.10.2016 20:11:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> That one is difficult to discover but super useful, so document it:
>> Specifying 3 or more commits makes git diff switch to combined diff.
>>
>> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
>> ---
>>
>> Notes:
>> Note that we have the following now:
>> ...
>> 'git diff A..B' equivalent to 'git diff A B'
>> in contrast to 'git log A..B' listing commits between M and B only
>> (without the commits between M and A unless they are "in" B).
>
> The standard answer is:
>
> Do not use two-dot form with 'git diff', if you find it
> confusing. Diff is about two endpoints, not about a range
> between two.
>
> The reason why we do not reject can be easily guessed by any
> intelligent person when some historical background is given, I
> think.
That is very well true. I'm more concerned with the presence, though,
that is: How easy to use is git now? Users choose git because they care
about the history of their project, not necessarily that of Git ;)
> - In the beginning A...B did not exist. A..B was the only "range"
> notation.
>
> - "git log A..B" was in wide use. Remember, "git log A...B" did
> not exist.
>
> - People started mistyping "git diff A..B", which looked as if the
> user typed "git diff ^A B" to the internal.
>
> - Git _could_ have rejected that as a bogus request to diff two
> points, ^A (what is that???) and B, but "What else could the user
> have meant with 'git diff A..B' other than 'git diff A B'?" was
> an argument to favor doing _something_ useful rather than
> erroring out. Remember, "A...B" did not exist when this
> happened.
It did not exist, but even at that point in time, "git log A..B" listed
only commits between the merge base and B, not those which are only in A
and not in B. Whereas "git diff A B" shows the differences between the
endpoints A and B.
>> @@ -12,6 +12,7 @@ SYNOPSIS
>> 'git diff' [options] [<commit>] [--] [<path>...]
>> 'git diff' [options] --cached [<commit>] [--] [<path>...]
>> 'git diff' [options] <commit> <commit> [--] [<path>...]
>> +'git diff' [options] <commit> <commit> <commit> [<commit>...]
>
> Made me wonder "is [<A>...] 0-or-more As or 1-or-more As?".
0-or-more, at least that's the way it is used in all lines here.
> Don't we allow pathspecs in this case?
Yes, the combinded diff mode kicks in only with no blobs (not: no
pathspec, which I had misread) and N>=3 commits. Maybe I should update
the code comments in builtin/diff.c to describe this, too.
Michael
next prev parent reply other threads:[~2016-10-27 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 21:40 generating combined diff without an existing merge commit Jacob Keller
2016-10-21 22:01 ` Jacob Keller
2016-10-21 22:41 ` Junio C Hamano
2016-10-21 22:54 ` Jacob Keller
2016-10-26 9:11 ` [PATCH] Documentation/git-diff: document git diff with 3+ commits Michael J Gruber
2016-10-26 18:11 ` Junio C Hamano
2016-10-27 9:27 ` Michael J Gruber [this message]
2016-10-27 18:40 ` 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
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=e74d4d84-d848-00be-8ca5-75204cf47262@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.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).