Subject: Re: Caching directories

From: Pavel Roskin <[email-masked]>
Date: Wed, 25 Jan 2006 02:29:32 -0500

On Tue, 2006-01-24 at 21:52 -0800, Junio C Hamano wrote:
> Pavel Roskin <[email-masked]> writes:
> 
> > Maybe it's time to start caching directories in git?  I mean,
> > directories corresponding to tree objects could have their stats
> > recorded in the cache.  This would allow to distinguish between tracked
> > and untracked directories without scanning them recursively.
> 
> I do not understand the above logic.  
> 
> Given a directory path, finding out if the directory has
> something tracked in it is an O(log n) operation in the current
> index that does not "cache directory".  Your message implies
> that you feel we could use the index file to list "untracked
> directories" without recursively scanning the directory tree,
> but to me, the only way to do that is to record a new directory
> in the index file every time somebody (either Makefile or the
> user) creates a junk directory.  That does not make much sense
> to me, so I am probably misreading what you really meant.

Sorry, it looks like my post was based on incorrect assumptions.  The
new --directory option to git-ls-files seems to be exactly what I want.
It allowed me to simplify cg-clean immensely.  Further simplification
will be possible once the support for .gitignore in parent directories
is fixed.

> I have no idea what 'clean' does, so would not comment on that
> part of your message.

It means removing untracked files and directories.

-- 
Regards,
Pavel Roskin