From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: David Ho <davidkwho@gmail.com>, git@vger.kernel.org
Subject: Re: git-diff-tree rename detection for single file
Date: Tue, 18 Oct 2005 20:12:43 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0510182004100.3369@g5.osdl.org> (raw)
In-Reply-To: <7virvujkcw.fsf@assigned-by-dhcp.cox.net>
On Tue, 18 Oct 2005, Junio C Hamano wrote:
>
> Having said that, I think we *could* introduce a new flag to
> git-diff-* brothers, --late-pathspec
Gaah. Why? It's really not possible to do it efficiently inside
git-diff-xyz, so whatever implementation would basically boil down to
something you can already do with some trivial scripting, basically
boiling down to:
git-diff-tree -r -M | grep pathnamelist | git-diff-helper
Now, several reasons why it's much better to do this kind of
"--late-pathspec" at a higher level (instead of inside the git-diff-xyz
family):
(a) git-diff-xyz is already some of the more complex core parts. It's not
likely a good idea to make them any more complex, unless there's some
very fundamental reason for it.
(b) without pathname limits, git-diff-tree is very slow. Well, it's
actually very fast compared to something braindead like CVS, but if
you want to track a single file over a thousand releases, it's MUCH
MUCH faster to do the pathname limit at the beginning. Otherwise
you'll spend all your time reading and comparing big trees with tens
of thousands of entries.
(c) with a higher-level thing, what you can do is have a TWO-phase thing:
use the fast pathname limiter in git-diff-tree to figure out when
that file changes in history, and then _only_ for those commits do
you go back and then do the much more expensive "git-diff-tree -r -M"
followed by the pathname-limiting post-processing.
See what I'm saying? You really can do the post-processing outside of
git-diff-tree, and you will in fact be much better off if you do so.
The performance impact of pruning the pathnames _before_ diffing them was
absolutely staggering. You couldn't reasonably do a "git-whatchanged -p"
on the kernel for a single file if you didn't do it the way we do it now.
Linus
next prev parent reply other threads:[~2005-10-19 3:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-18 19:56 git-diff-tree rename detection for single file David Ho
2005-10-18 20:50 ` Junio C Hamano
2005-10-19 2:45 ` Junio C Hamano
2005-10-19 3:12 ` Linus Torvalds [this message]
2005-10-19 5:20 ` Junio C Hamano
2005-10-19 16:04 ` Nicolas Pitre
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=Pine.LNX.4.64.0510182004100.3369@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=davidkwho@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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