git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Updated Kernel Hacker's guide to git
Date: Fri, 22 Dec 2006 15:31:09 -0800	[thread overview]
Message-ID: <8764c3ik3m.wl%cworth@cworth.org> (raw)
In-Reply-To: <7v7iwjwnwh.fsf@assigned-by-dhcp.cox.net>

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

On Fri, 22 Dec 2006 14:45:18 -0800, Junio C Hamano wrote:
> Exactly; diff just reuses the non-magic part of revision
> parameter parsing without using the ancestry traversal
> machinery (which is the magic part).

Thanks, that helps.

> It knows that rev-parse makes it "b a ^base", and it knows what
> the user meant is "base..b".

Ahah! So the "a...b" syntax is how to get at what:

	git diff $(git merge-base a b) b

would give. Thanks for explaining, since that was not at all obvious.

> That's all because we teach them to spell "a...b" when they want
> "base..b".  Similarly, because we allow them to spell "a..b"
> when they mean "between two points, a and b", it handles "b ^a"
> as the equivalent to giving two trees separately, as "a b".

Where is that teaching happening exactly? Both the "a..b" and "a...b"
forms seem to be entirely missing from the documentation of git
diff. :-)

> I do not think you are seriously saying that comparing A and
> B in this picture is meaningless:
>
>       o---o---B
>      /
>  ---M---o---A

No, I'm certainly not saying that that that comparison is meaningless.

All I was trying to say is that comparing M to B would be meaningful
too, and I hoped that git would provide good syntax for both. If I'm
understanding things correctly now, what exists is:

  git diff A B
  git diff A..B

	Compare A to B

  git diff A...B

	Compare M to B

So, at the beginning of this thread I wasn't aware that git provided
any short syntax for the "M to B" comparison, (the thread started with
suggestions for adding "git diff $(git merge-base A B) B" to the
hackers guide).

Now, I'm happy to know that git does provide a short syntax for that
useful operation.

My only comment now is that the distinction between ".." and "..." in
git-diff is quite surprising. In fact, in one sense it's exactly
opposite from the distinction of ".." and "..." as used in git log.

For example, given the above graph, "git diff A..B" shows changes due
to all 5 of commits on both branches while "git log -p A..B" shows
only the changes of the 3 commits from M to B.

Meanwhile, "git diff A...B" shows changes due to the 3 commits from M
to B while "git log -p A...B" shows the changes from all 5 of the
commits on both branches.

That's really surprising behavior (to me at least).

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-12-22 23:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 12:24 Updated Kernel Hacker's guide to git Francis Moreau
2006-12-21 18:23 ` Linus Torvalds
2006-12-22  1:23   ` Carl Worth
2006-12-22  4:13     ` Linus Torvalds
2006-12-22 22:20       ` Carl Worth
2006-12-22 22:34         ` Linus Torvalds
2006-12-22 22:45         ` Junio C Hamano
2006-12-22 23:31           ` Carl Worth [this message]
2006-12-22 23:00         ` Jakub Narebski
2006-12-22  9:35   ` Francis Moreau
2006-12-22 10:26     ` Junio C Hamano
2006-12-22 20:34       ` Francis Moreau
  -- strict thread matches above, loose matches on Subject: below --
2006-12-21  3:04 Jeff Garzik
2006-12-21  3:21 ` Jay Cliburn
2006-12-21  7:04   ` Martin Langhoff
2006-12-21  7:32     ` Junio C Hamano
2006-12-21  7:51   ` Linus Torvalds
2006-12-21 11:53   ` Jeff Garzik
2006-12-21  5:44 ` Willy Tarreau
2006-12-21  5:53 ` Nigel Cunningham
2006-12-21 11:44   ` Jeff Garzik
2006-12-21 21:17     ` Nigel Cunningham
2006-12-21 13:53 ` Francois Romieu
2006-12-21 20:40 ` Guennadi Liakhovetski
2006-12-21 20:46   ` Jeff Garzik
2006-12-22  8:50 ` Jesper Juhl
2006-12-24 18:07 ` Horst H. von Brand
2007-12-23 11:13   ` Jeff Garzik
2007-12-23 12:08     ` Robert P. J. Day
2007-12-23 12:13       ` Jeff Garzik
2007-12-23 12:20         ` Robert P. J. Day
2007-12-23 13:05           ` Dieter Ries
2007-12-23 17:23             ` Robert P. J. Day
2007-12-23 20:14             ` Stefan Richter
2007-12-24 14:19             ` Robert P. J. Day
2007-12-23 12:25     ` WANG Cong
2007-12-24 12:50     ` Miklos Vajna
2007-12-25 13:08     ` Salikh Zakirov
2007-12-31  2:50     ` Jan Engelhardt
2007-12-31 11:26       ` Stefan Richter
2007-12-31 17:31         ` Junio C Hamano
2008-06-30  2:51         ` Jeff Garzik
2008-06-30  6:27           ` Stefan Richter
2008-06-30  2:49       ` Jeff Garzik
2008-07-03  6:26         ` Christian Couder

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=8764c3ik3m.wl%cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).