git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, git@vger.kernel.org
Subject: Re: my git problem
Date: Wed, 30 Apr 2008 23:01:32 -0700	[thread overview]
Message-ID: <871w4mwojn.wl%cworth@cworth.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0804281200130.3119@woody.linux-foundation.org>

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

On Mon, 28 Apr 2008 12:21:17 -0700 (PDT), Linus Torvalds wrote:
> On Mon, 28 Apr 2008, Andrew Morton wrote:
> > 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).

Yes, the two operations are internally operating on different things,
(exactly as described).

> And "a..b" and "a...b" means two totally different things for the two
> totally different operations.

But the internal difference doesn't justify the totally different
meaning of "a..b" and "a...b" for these two operations. And in the
rest of your message you didn't justify the difference at all, (just
the fact that there *can* be a difference).

As a concrete example, I often want to view a series of patches that
is unique to a branch. I can easily do that with:

	git log -p a..b

Now, if I want to view basically the same information, but in a
"combined" view, (a single patch from the beginning to the final
state), I have to instead do:

	git diff a...b

And that's the part that's really confusing people, I think, (see
Andrew Morton running into the problem here, and Havoc Pennington
elsewhere). Conceptually, "a..b" is a way to say "the commits that are
unique to 'b' compared to 'a'", and that works great for git-log. But
when a similar concept is often desired for git-diff it's spelled
"a...b" instead. What's the justification for that? (Other than
historical accident.)

Meanwhile, you could even point to a similar case with the opposite
forms of each command. That is, one can see a series of patches with:

	git log -p a...b

And again, one can get get basically the same information in a
combined, single-patch form with:

	git diff a..b
or:	git diff b..a

depending on which direction one would like the combined version to be
in. Again, why the opposite syntax for basically the same information?

So git-log and git-diff are consistent in not treating the ".." and
"..." syntax uniformly, but I can't see any good justification for
that.

I don't think this second case is causing much problem. The symmetric
difference that's described by "git log a...b" isn't something I end
up needing very often, anyway. Meanwhile, a single patch between two
arbitrary states is extremely common, but I've always expressed that
naturally as "git diff a b", (by analogue with good old "diff fileA
fileB"), and never felt a need to spell this command as "git diff
a..b".

So, I do think the handling of ".." and "..." in git-diff is
objectively backwards compared to the way that git-log, git-rev-list
and everything else treat these operators.

I don't know what can be done to fix this now, though. Just expect
users to get confused, and then try to get them to drill "git log
a..b" and "git diff a...b" into their wee little brains.

Or maybe go Elijah's route and invent a new top-level command name in
which issues like this can get fixed. (I've been lukewarm on the idea
after watching the cogito attempt eventually be abandoned. I'd really
much rather see Elijah's ideas get pushed down into git itself for the
most part. But it's tough when backwards-compatibility prevents fixing
some things that are obviously confusing people.)

-Carl

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

  parent reply	other threads:[~2008-05-01  6:21 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
2008-05-01  6:01           ` Carl Worth [this message]
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=871w4mwojn.wl%cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=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).