Re: Updated Kernel Hacker's guide to git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: pgp69CQPnKJtS.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]