From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: Updated Kernel Hacker's guide to git
Date: Sat, 23 Dec 2006 00:00:12 +0100 [thread overview]
Message-ID: <emhnsm$iuo$1@sea.gmane.org> (raw)
In-Reply-To: 877iwjinda.wl%cworth@cworth.org
[Cc: Carl Worth <cworth@cworth.org>, Linus Torvalds <torvalds@osdl.org>
git@vger.kernel.org]
Carl Worth wrote:
> On Thu, 21 Dec 2006 20:13:52 -0800 (PST), Linus Torvalds wrote:
>> I do it all the time, I never even use the old-fashioned syntax any more.
>> It's much more concise and easy to read, and it has all the nice shortcuts
>> (like empty meaning "HEAD", so you can do "git diff ..next" to see the
>> diff from HEAD to another branch).
>
> I can understand the advantage of a shortcut like "git diff ..next",
> but I still don't understand why it's the comparison of HEAD and next
> that's really interesting here. Wouldn't comparing the merge-base to
> next be more desirable? For example, if I'm considering whether to
> merge in next or not, why should I care to see in the diff all the
> irrelevant stuff that's happened on HEAD since next branched off?
>
> But, really, I still don't understand exactly _what_ "diff a..b" even
> means. Can you explain it to me?
For me, it's just a bit of syntactic sugar (I always have in mind that
git-log and friends outputs commit list and use revisions range, while
git-diff and friends needs two (or less) revisions) allowing to
copy'n'paste arguments from "git log a..b" to "git diff a..b"
> Presumably the rev-parse magic is happening to the arguments. So does
> the diff code just end up seeing the expanded equivalent of "b ^a" and
> then just use the ^ to decide which tree to be on the left side or
> something?
And that is just implementation. I don't think anyone uses "git diff b ^a".
>> It's also useful exactly because of the semantics of things like "...".
>
> And now I'm really confused. If I'm not mistaken, rev-parse will turn
> "a...b" into something like "a b ^$(merge-base a b)", right? So does
> the diff code now end up seeing three different tree specifiers? What
> does it do with that? And how is this useful? (As you said before,
> diff is always going to end up acting on only two items, so I don't
> see where there could be an interesting distinction from how you
> obtain two items from "a..b" compared to "a...b".) But it might be
> just that I'm really confused here.
I would have thought that it would be combined diff of a and b against
it's merge base... but it is not.
"git diff a...b" is turned into "git diff a b ^$(git merge-base a b)",
and by a bit of magic (and by a convention) it is turned into
"git diff ^$(merge-base a b) a" (and a...b ceases to be _symmetric_
for git-diff).
I'd like for "git diff --cc a...b" to do 'the right thing' and show
git diff --cc for pretended merge (I'm not sure if with or without
resolving trivial conflicts).
>> So "git diff a b" doesn't even look good to me any more, because it's
>> literally missing that mental "to" that the ".." adds for me when I read
>> it.
>
> OK, that's fine. But can you comment on why you want the comparison
> between the tips and not something based on a comparison from the
> merge-base to a tip?
a..b does not imply merge-base, a...b does.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
next prev parent reply other threads:[~2006-12-22 22:57 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
2006-12-22 23:00 ` Jakub Narebski [this message]
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='emhnsm$iuo$1@sea.gmane.org' \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.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).