using git directory cache code in darcs?

From: David Roundy <>
Date: 2005-04-16 23:22:36
Hello Linus and various git developers (ccing darcs developers),

I've been thinking about the possibility of using the git "current
directory cache" code in darcs.  Darcs already has an abstraction layer
over its pristine directory cache, so this shouldn't be too hard--provided
the git code is understandable.  The default in darcs is currently to use
an actual directory ("_darcs/current/") as the cache, and we synchronize
the file modification times in the cache with those of identical files in
the working directory to speed up compares.  We (the darcs developers) have
talked for some time about introducing a single-file directory cache, but
noone ever got around to it, partly because there wasn't a particularly
compelling need.

It seems that the git directory cache is precisely what we want.  Also, if
we switch to (optionally) using the git directory cache, I imagine it'll
make interfacing with git a lot easier.  And, of course, it would
significantly speed up a number of darcs commands, which are limited by the
slowness of the readdir-related code.  We haven't tracked this down why
this is, but a recursive directory compare in which we readdir only one of
the directories (since we don't care about new files in the other one)
takes half the time of a compare in which we readdir both directories.

So my questions are:

1) Would this actually be a good idea? It seems good to me, but there may
be other considerations that I haven't thought of.

2) Will a license be chosen soon for git? Or has one been chosen, and I
missed it? I can't really include git code in darcs without a license.  I'd
prefer GPLv2 or later (since that's how darcs is licensed), but as long as
it's at least compabible with GPLv2, I'll be all right.

3) Is it likely that git will switch to not using global variables for
active_cache, active_nr and active_alloc? I'd be more comfortable passing
these things around, since it would make the haskell interface easier and
safer.  e.g. I'd like

struct git_cache {
        struct cache_entry **cache;
        unsigned int nr, alloc;

git_cache *read_cache(char *path_to_index);

or alternatively

int read_cache(char *path_to_index, git_cache *);

Would anyone on the git side be interested in making such changes? If not,
would they be likely to be accepted if a darcs person submitted patches?

4) Would there be interest in creating a libgit? I've been imagining taking
git source files and including them directly in darcs' code, but in the
long run it would be easier if there were a standard git API we could use.

I guess that's about all.
David Roundy
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Sat Apr 16 23:27:42 2005

This archive was generated by hypermail 2.1.8 : 2005-04-16 23:27:42 EST