git/list[1] front-page[2] threads[3] people[4] search[5] about
 

using git directory cache code in darcs?

From
David Roundy <droundy@abridgegame.org>
Date
Apr 16, 2005, 13:22 UTC
Message-ID
<20050416132231.GJ2551@abridgegame.org>
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
http://www.darcs.net
Next: Ingo Molnar
Message 1 of 14 in “using git directory cache code in darcs?”
  1. David RoundyApr 16, 2005
  2. Ingo MolnarApr 16, 2005
  3. Junio C HamanoApr 16, 2005
  4. Linus TorvaldsApr 16, 2005
  5. David RoundyApr 17, 2005
  6. Linus TorvaldsApr 17, 2005
  7. Mike TahtApr 17, 2005
  8. Nomad ArtonApr 17, 2005
  9. Junio C HamanoApr 17, 2005
  10. Paul JacksonApr 18, 2005
  11. Paul JacksonApr 18, 2005
  12. Linus TorvaldsApr 18, 2005
  13. Paul JacksonApr 18, 2005
  14. git optionsMike Taht, Apr 18, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.