git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: Re: my git problem
Date: Mon, 28 Apr 2008 12:54:00 -0700	[thread overview]
Message-ID: <20080428125400.e91c1c24.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0804281200130.3119@woody.linux-foundation.org>

On Mon, 28 Apr 2008 12:21:17 -0700 (PDT) Linus Torvalds <torvalds@linux-foundation.org> wrote:

> 
> 
> On Mon, 28 Apr 2008, Andrew Morton wrote:
> > 
> > hm, weirdness.
> > 
> > y:/usr/src/git26> git-diff origin...git-ia64   
> > y:/usr/src/git26> git-log origin...git-ia64 | wc -l
> > 15574
> > 
> > I'd have expected git-log to operate on the same patches as git-diff.
> 
> No, not at all.
> 
>  - "git log" shows each commit in a range.
> 
>  - "git diff" shows just the difference between two states.
> 
> The two have nothing in common. One operates on lots of individual commits 
> (git log) individually, while the other one fundamentally operates on just 
> two end-points (git diff).
> 
> And "a..b" and "a...b" means two totally different things for the two 
> totally different operations.
> 
> When doing "a..b" and looking at individual commits, it means "show all 
> commits that are in b but *not* in a". And when doing "a..b" when asking 
> for a "diff", it means "show the difference from 'a' to 'b'".
> 
> They are *very* different operations indeed. The log can be empty, even if 
> the diff is not empty (example: b is _before_ a, so there is nothing in 
> 'b' that isn't in 'a', but that doesn't mean that 'b' is *equal* to 'a', 
> so there is still a diff!). And the log can be non-empty, even if the diff 
> is empty (example: 'b' and 'a' have the same actual tree, but two 
> different ways of gettign there: the diff is empty, but the log of commits 
> in between them is not).

whimper.

> So anybody who thinks that 'diff' and 'log' have *anything* to do with 
> each other is fundamentally confused.

hi, everyone.

>  Not just about git, btw. It's true 
> in any model - it's fundamental.
>
> As to 'a...b', it also means somethign different for diff (two endpoints!) 
> and log (set of commits). For diff, it means "show the difference between 
> the common commit and 'b'", while for log it means "show all commits that 
> are in either 'a' or 'b' but *not* in both".
> 
> So you should do
> 
> 	# generate the diff from the common point
> 	git diff -p --stat a...b
> 
> 	# show the commits that are in b but not in a
> 	git log a..b

That seems to work nicely, thanks.

> where the difference between two dots and three dots is important, and 
> stems directly from the fact that 'diff' and 'log' are two totally 
> different operations that cannot _possibly_ have semantics that mean the 
> same thing - because a "set of commits" is fundamentally different from 
> "difference betwen two endpoints".

yup.

  reply	other threads:[~2008-04-28 19:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 18:29 my git problem Andrew Morton
2008-04-27 19:15 ` Linus Torvalds
2008-04-27 19:44   ` Andrew Morton
2008-04-27 20:24     ` Linus Torvalds
2008-04-28 18:45       ` Andrew Morton
2008-04-28 18:49         ` Johannes Schindelin
2008-04-28 19:09           ` Andrew Morton
2008-04-28 19:13             ` Johannes Schindelin
2008-04-28 19:28               ` Linus Torvalds
2008-04-29 17:15                 ` J. Bruce Fields
2008-04-30  8:17                   ` Jakub Narebski
2008-04-28 19:33               ` Andrew Morton
2008-04-28 19:21         ` Linus Torvalds
2008-04-28 19:54           ` Andrew Morton [this message]
2008-05-01  6:01           ` Carl Worth
2008-04-28 19:52         ` Daniel Barkalow
2008-04-28 21:35       ` Andrew Morton
2008-04-28 21:47         ` Linus Torvalds
2008-04-28 22:04           ` Johannes Schindelin
2008-04-28 22:14           ` Linus Torvalds
2008-04-29  2:14             ` Andrew Morton

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=20080428125400.e91c1c24.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 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 NNTP newsgroup(s).