administrative functions for rev-cache, and start of integration into git
PATCH 4/5 administrative functions for rev-cache, and start of integration into git
This patch, fourth, contains miscellaneous (maintenance) features:
- support for cache slice fusion, index regeneration and object size caching
- extra 'size' field added to commit, tag and blob objects, initialized in parse_* functions and cache traversal
- non-commit object generation refactored to take advantage of 'size' field
- porcelain updated to support feature additions
The beginnings of integration into git are present in this patch, mainly centered on caching object size; the object generation is refactored to more elegantly exploit this. Fusion allows smaller (incremental) slices to be coagulated into a larger slice, reducing overhead, while index regeneration enables repair or cleaning of the cache index.
Note that tests for these features are included in the following patch, as they take advantage of the rev-cache's integration into the revision walker.
--- blob.c | 1 + blob.h | 1 + builtin-rev-cache.c | 49 ++++++- commit.c | 1 + commit.h | 1 + rev-cache.c | 416 ++++++++++++++++++++++++++++++++++++++++++--------- revision.h | 4 +- 7 files changed, 397 insertions(+), 76 deletions(-)
blob.c +1 -0
@@ -21,6 +21,7 @@ struct blob *lookup_blob(const unsigned char *sha1)int parse_blob_buffer (struct blob *item,void *buffer,unsigned long size) { item->object.parsed =1 ; + item->size = size;return 0 ; }
blob.h +1 -0
@@ -7,6 +7,7 @@ extern const char *blob_type;struct blob {struct object object; +unsigned long size; };struct blob *lookup_blob (const unsigned char *sha1);
builtin-rev-cache.c +48 -1
75 lines not on this page · raw message
commit.c +1 -0
@@ -243,6 +243,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)if (item->object.parsed)return 0 ; item->object.parsed =1 ; + item->size = size; tail += size;if (tail <= bufptr +46 ||memcmp (bufptr,"tree " ,5 ) || bufptr[45 ] !='\n' )return error ("bogus commit object %s" ,sha1_to_hex (item->object.sha1));
commit.h +1 -0
@@ -19,6 +19,7 @@ struct commit {struct commit_list *parents;struct tree *tree;char *buffer; +unsigned long size; };extern int save_commit_buffer;
rev-cache.c +342 -74
589 lines not on this page · raw message
revision.h +3 -1
@@ -207,6 +207,8 @@ extern int make_cache_slice(struct rev_cache_info *rci,extern int make_cache_index (struct rev_cache_info *rci,unsigned char *cache_sha1,int fd,unsigned int size); -extern void starts_from_slices (struct rev_info *revs,unsigned int flags); +extern void starts_from_slices (struct rev_info *revs,unsigned int flags,unsigned char *which,int n); +extern int coagulate_cache_slices (struct rev_cache_info *rci,struct rev_info *revs); +extern int regenerate_cache_index (struct rev_cache_info *rci);#endif