Nicolas Pitre <nico@xxxxxxx> wrote: > On Fri, 16 Mar 2007, Johannes Schindelin wrote: > > > We already _have_ the data structures! > > Well... Shawn and I are contemplating alternate data structures to > improve things dramatically. Hang on. Yes, Nico and I are contemplating alternate disk based data structure, and in some cases, alternate memory based data structures to improve things. But these structures are not changing the basic Git data structures that have been with us since way back when. ;-) Commits still have the same fields, with the same data and the same meaning. Trees still have the same fields, and same meaning... etc. > With a fixed public API I doubt such improvements could be as effective. They still can be, and without shooting ourselves in the foot in the process. > So... if any API is to be developed, I'd argue that it must be done > _above_ the existing code with a higher level of abstraction and a much > narrower scope. Yes. Today we have a frozen API for commit walking. Its called `git rev-list --pretty=raw A ^B`. That output format is pretty well set in stone, and we cannot change it. Everyone knows what each field means, and hopefully knows that additional fields can be added. ;-) Instead of formatting out those fields as hex strings, or as decimal integer dates, we can offer them in a struct. E.g.: struct git_objid { const unsigned char *obj_name; }; struct git_commit { struct git_objid tree; struct git_objid *parents; uint32_t nr_parent; const char *author; time_t author_date; int author_tz; const char *committer; time_t committer_date; int committer_tz; const char *message; }; With the rule that the pointers are to static memory buffers that libgit is loaning out to the caller (the caller should *not* free these buffers). This lets us play cute tricks down in the lower tiers by pointing directly into the packfile dictionary tables (saves memcpys); or xstrdup/xmalloc everything we give out if we want to be really paranoid. Just tossing ideas out - don't think that what I wrote above is my final suggestion on the matter. It may change in another day or two if I think about it more. ;-) -- Shawn. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html