Re: my git problem
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Apr 30, 2008, 08:17 UTC
- Message-ID
- <m3prs7oixp.fsf@localhost.localdomain>
- In-Reply-To
- <20080429171519.GA21310@fieldses.org>
"J. Bruce Fields" <bfields@fieldses.org> writes:
Show 16 quoted lines
> On Mon, Apr 28, 2008 at 12:28:38PM -0700, Linus Torvalds wrote: >> >> >> On Mon, 28 Apr 2008, Johannes Schindelin wrote: >>> >>> On Mon, 28 Apr 2008, Andrew Morton wrote: >>>> >>>> That's missing the "logical" bit :) >>> >>> Heh, you're right. I am too used to Git to think how other people would >>> feel about these things... :-) >> >> No, you are both wrong. >> >> You're wrong because apparently you never did abstract algebra and set >> theory in school.
[...]
Show 10 quoted lines
>> If you know math, git actually does the rigth and very much the *logical* >> thing. >> >> So ".." is a simple difference, while "..." is a more complex difference. >> >> They mean different things for different operation types, but that is >> again something a math person takes for granted (ie in algebra, a "+" or >> "-" is just a random operation that follows certain rules: "a-b" means one >> thing for the set of real numbers, and something *totally* different if >> you are talking about set algebra).
[...]
Show 6 quoted lines
> I can sorta buy the argument that "A...B" means most generally "some > kind of difference between the three sets A, A^B, and B", and that in > the context of "git diff" it's most sensible to take ordering into > account and produce some approximation of a diff between A^B and B. I'd > personally have found an entirely separate operator simpler to > understand. But perhaps there's only so many keys on the keyboard.
IMHO adding support for a..b and a...b to git-diff is a bit of trick, as a..b and a...b were created to represent a set of revisions (a revision range).
If we have linear history:
*---*---*---a---*---*---b
then a..b notation for a revision range is very natural, and having git-diff interprete "a..b" as "a b" (for git-diff only endpoints matter) to allow copy'n'pasting between git-log and git-diff, and between git-fetch messages and git-diff was a good extension.
Now if the history is not linear, as in example below:
*---*---*---x---*---*---b
\
\-*---athen "a..b", which is shortcut for "b ^a" (b --not a), returns x..b range (set) of revisions. If you read "a..b" as "what's in 'b' since 'a'" it makes perfect sense. But "git diff a..b" is still "git diff a b", not "git diff x b".
It would be perhaps as good notation to have "git diff a..b" mean "git diff x b", i.e. be diff between endpoints of "git log a..b", and have "git diff a...b" be "git diff a b", i.e. to be diff between endpoints^W points of "git log a...b"... but if there is no clean winner, simplicity of implementation wins.
-- Jakub Narebski Poland ShadeHawk on #git