git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Olaf Hering <olaf@aepfle.de>, John Keeping <john@keeping.me.uk>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git log fails to show all changes for a file
Date: Wed, 15 Jul 2015 10:13:12 -0700	[thread overview]
Message-ID: <CA+55aFy8urE+0w7mfgywcAnyoUu+6LMz-GGaOrUQYJ59gT9FfA@mail.gmail.com> (raw)
In-Reply-To: <xmqq8uahxu3e.fsf@gitster.dls.corp.google.com>

On Wed, Jul 15, 2015 at 9:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> I would think "git log -p" that implies "--cc" would be a good
> change, as long as there is an easy escape hatch to let us do what
> we have to do with a rather lengthy "git log -p --first-parent -m"
> (i.e. show the change relative to its first parent while traversing
> the first parent chain) today.  Perhaps only when there is no
> explicit "-m" but "-p" is given, automatically enable "--cc", or
> something like that.

That's very close to what "git show" does through that magic
show_rev_tweak_rev() logic, with the crucial difference being that
"git show" is designed to always show the diff, so the "-p" is
implied.

That said, having thought about it more, I'm not entirely sure we can
do it.  The big conceptual difference between "git log" and "git show"
is obviously that "git show" doesn't walk the revision list, and you
always explicitly say "show _this_ commit".

And that means that with "git show", you kind of _know_ that the
commit is relevant and interesting, in a way that "git log" does not.
So got "git show", it's very natural to say "show all the relevant
information", while for "git log" we did make the choice that maybe
commit diffs aren't relevant by default.

And the whole issue ends up boiling down to "maybe we picked the wrong
choice default". We default to that "ignore_merges = 1" behavior.

Now, we defaulted to ignoring merge diffs because long long ago, in a
galaxy far away, we didn't have a great way to show the diffs. The
whole "--cc" option goes back to January -06 and commit d8f4790e6fe7
("diff-tree --cc: denser combined diff output for a merge commit") .
And before that option - so for about 8 months - we had no good way to
show the diffs of merges in a good dense way.

So the whole "don't show diffs for merges by default" actually made a
lot of sense originally, because our merge diffs were not very useful.

But that does mean that if we now enable "--cc" by default when you
ask for diffs, we have no good way to _disable_ it. We picked "disable
by default", and "-m" means "enable merge diffs". And that made sense
back in 2005 because we really wanted to disable the whole "show diffs
for merges" thing.

Of course, you can use "--no-merges" to basically not show merges at
all, so maybe that's ok. But I get the feeling that if we make "-p"
imply "--cc", we should probably add a "--no-merge-diff" option too to
replace the (broken) "-m" flag properly. And I'm a tiny bit worried
that it might break some script (although I'm really not seeing
how/why you'd script "git log -p" output and not want to get a --cc
patch for a merge).

And "-m"? We should probably get rid of it. The diffs we get for
merges when "-c" or "--cc" isn't given are _not_ useful. The original
non-combined diff format was really just useful for showing that
"yeah, we have multiple parents, and they are different in all these
ways".  So there is no actual valid use for "-m" that I can imagine.
It's simply just an odd historical artifact from a time when we didn't
know how to show merges.

                 Linus

  reply	other threads:[~2015-07-15 17:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  7:30 git log fails to show all changes for a file Olaf Hering
2015-07-14  7:45 ` John Keeping
2015-07-14  7:59   ` Olaf Hering
2015-07-14 17:54     ` Andreas Schwab
2015-07-14 19:16     ` Linus Torvalds
2015-07-15 16:29       ` Junio C Hamano
2015-07-15 17:13         ` Linus Torvalds [this message]
2015-07-15 17:58           ` Junio C Hamano
2015-07-15 18:11             ` Linus Torvalds
2015-07-15 18:17               ` Junio C Hamano
2015-07-15 18:57                 ` Jeff King
2015-07-15 19:22                   ` Junio C Hamano
2015-07-15 19:17                 ` Linus Torvalds

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+55aFy8urE+0w7mfgywcAnyoUu+6LMz-GGaOrUQYJ59gT9FfA@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=john@keeping.me.uk \
    --cc=olaf@aepfle.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).