Git development
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Split up tree diff functions into tree-diff.c library
Date: Fri, 21 Oct 2005 08:19:30 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0510210814310.10477@g5.osdl.org> (raw)
In-Reply-To: <7v64rr2y4q.fsf@assigned-by-dhcp.cox.net>



On Thu, 20 Oct 2005, Junio C Hamano wrote:
>
> I have not closely studied the user of this change, rev-list,
> but I have a hunch that you might be better off, if you define a
> new diff "format", DIFF_FORMAT_CALLBACK, and hook into
> diff_flush(), instead of hooking into diff_addremove() and
> diff_change().

No, I did that on purpose.

I did _not_ want the library interface users to have to use the flushing 
and all the associated memory management and complexity issues.

The thing is, the only thing rev-list wants to know is whether there was a 
diff at all, and I want to eventually make "opt->change()" and 
"opt->add_remove()" return a possible error code so that the whole diff 
library can just stop on the first change, since once we've seen _any_ 
change, we don't care any more.

Also, by taking it over at this lieve, you don't need to do any of the 
diff setup at all to use the core routines.

Now, if somebody _wants_ to hook into flushing, you can still do so: you 
just do

	opt->add_remove = diff_addremove;
	opt->change = diff_change;

and then you can hook into the higher-level functions if you want to. But 
for a lot of uses, I bet we do _not_ want to. And those higher-level 
routines have had some _serious_ memory use problems etc: by hooking into 
the lower level, we can bypass all of that.

(A memory leak in diff in git-rev-parse would be deadly on big archives).

> Right now, you are only making the parallel tree traversing and
> comparing part from diff-tree available in the library form
> (which is fine), but that way leaves the door open for it to
> also use the rest of the diffcore machinery.

The point is, we don't _want_ to use the rest of the diffcore machinery. 
It's too expensive and fragile.

		Linus

      reply	other threads:[~2005-10-21 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21  4:05 Split up tree diff functions into tree-diff.c library Linus Torvalds
2005-10-21  6:16 ` Junio C Hamano
2005-10-21 15:19   ` Linus Torvalds [this message]

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.0510210814310.10477@g5.osdl.org \
    --to=torvalds@osdl.org \
    --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