All of lore.kernel.org
 help / color / mirror / Atom feed
* Three dot notion used inconsitent?
@ 2015-11-18 10:31 Lars Schneider
  2015-11-18 11:02 ` Johannes Löthberg
  2015-11-18 17:49 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Lars Schneider @ 2015-11-18 10:31 UTC (permalink / raw)
  To: GIT Mailing-list

Hi,

I just stumbled across the this:

git diff branchA...branchB
--> gives me the diff between (the common ancestor of A and B) and B. That means I never see changes on branchA.

git log branchA...branchB
--> gives me the commits reachable from A and B. That includes changes from branchA.

Is this because of a design decision that I do not (yet) understand or is this inconsistent for historical reasons?

Thanks,
Lars

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

* Re: Three dot notion used inconsitent?
  2015-11-18 10:31 Three dot notion used inconsitent? Lars Schneider
@ 2015-11-18 11:02 ` Johannes Löthberg
  2015-11-18 17:49 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Löthberg @ 2015-11-18 11:02 UTC (permalink / raw)
  To: Lars Schneider; +Cc: GIT Mailing-list

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

On 18/11, Lars Schneider wrote:
>git diff branchA...branchB
>--> gives me the diff between (the common ancestor of A and B) and B. That means I never see changes on branchA.
>
>git log branchA...branchB
>--> gives me the commits reachable from A and B. That includes changes from branchA.
>
>Is this because of a design decision that I do not (yet) understand or is this inconsistent for historical reasons?
>

The standard meaning of A...B is all the commits reachable from A or B, 
but not from both. (See gitrevisions(7) for more info.)

git-diff has its own nonstandard definition, where A...B is defined as 
all the commits from a comman ancestor of A and B, up to B.

-- 
Sincerely,
  Johannes Löthberg
  PGP Key ID: 0x50FB9B273A9D0BB5
  https://theos.kyriasis.com/~kyrias/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1565 bytes --]

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

* Re: Three dot notion used inconsitent?
  2015-11-18 10:31 Three dot notion used inconsitent? Lars Schneider
  2015-11-18 11:02 ` Johannes Löthberg
@ 2015-11-18 17:49 ` Andreas Schwab
  2015-11-20  9:53   ` Michael J Gruber
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2015-11-18 17:49 UTC (permalink / raw)
  To: Lars Schneider; +Cc: GIT Mailing-list

Lars Schneider <larsxschneider@gmail.com> writes:

> git diff branchA...branchB
> --> gives me the diff between (the common ancestor of A and B) and B. That means I never see changes on branchA.
>
> git log branchA...branchB
> --> gives me the commits reachable from A and B. That includes changes from branchA.
>
> Is this because of a design decision that I do not (yet) understand or is this inconsistent for historical reasons?

git diff operates on two revisions.  That is inherently incompatible
with the usual meaning of A...B and A..B, which are set operations on
the revision history.  That git diff accepts this syntax is only for
convenience.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Three dot notion used inconsitent?
  2015-11-18 17:49 ` Andreas Schwab
@ 2015-11-20  9:53   ` Michael J Gruber
  0 siblings, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2015-11-20  9:53 UTC (permalink / raw)
  To: Andreas Schwab, Lars Schneider; +Cc: GIT Mailing-list

Andreas Schwab venit, vidit, dixit 18.11.2015 18:49:
> Lars Schneider <larsxschneider@gmail.com> writes:
> 
>> git diff branchA...branchB
>> --> gives me the diff between (the common ancestor of A and B) and B. That means I never see changes on branchA.
>>
>> git log branchA...branchB
>> --> gives me the commits reachable from A and B. That includes changes from branchA.
>>
>> Is this because of a design decision that I do not (yet) understand or is this inconsistent for historical reasons?
> 
> git diff operates on two revisions.  That is inherently incompatible
> with the usual meaning of A...B and A..B, which are set operations on
> the revision history.  That git diff accepts this syntax is only for
> convenience.

That convenience can be a bit misleading, though, as the OP points out.
Just to spell this out because the other response (not the one I'm
replying to) could be misunderstood:

git diff A..B is the diff between (the trees in commits) A and B. It
will show you the "changes" that are only in A with "-", the changes
that are only in B with "+" - that is, if you want to think about diffs
as "positive changes" to a "virtual common base tree".

[ If p are the plus lines and m the minus lines, the diff says
    B = A + p - m = (A-m) + p
<=> A = B - p + m = (B-p) + m
<=> B-p = A-m (virtual common base tree) ]

git log A..B will show you all commits that are in (=reachable from) B
but not in A. That is, it will show you all commits between the "most
recent" common ancestor (let's call it C) and B (including B), but not
those between C and A (and not A either).

git log A...B will show you all commits "specific to A and B", i.e.
those between C and B and those between C and A (including A and B,
excluding C).

git diff A...B will show you the diff between C and B.

So, both "diff A..B" and "log A...B" show changes/commits introduced by
A only or B only.

"diff A...B" and "log A..B" show changes/commits introduced by B only.

Maybe there's a way to think about these that makes them actually look
consistent - the only one that I can think of is the actual
implementation (we need to compute the merge base for both "..."
commands), but that's a really bad argument for a user facing notation.

Michael

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

end of thread, other threads:[~2015-11-20  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 10:31 Three dot notion used inconsitent? Lars Schneider
2015-11-18 11:02 ` Johannes Löthberg
2015-11-18 17:49 ` Andreas Schwab
2015-11-20  9:53   ` Michael J Gruber

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.