rev-cache: misc features + slight refactor
PATCH 3/4 rev-cache: misc features + slight refactor
Several miscellaneous features of rev-cache are introduced, and the non-commit object generation is refactored. Cache coagulation and index regeneration are added, allowing for cache slice maintenance and garbage collection. Commit and blob objects are modified to store object size, as the tree object does, and this parameter is instated upon parsing. Object enumeration makes use of this addition and more fluidly generates its list.
Tests for coagulation and index generation are added in the integration patch, as the former in its proper incarnation makes use of rev-cache's influence on the revision walker.
--- blob.c | 1 + blob.h | 1 + builtin-rev-cache.c | 49 ++++++- commit.c | 1 + commit.h | 1 + rev-cache.c | 415 ++++++++++++++++++++++++++++++++++++++++++--------- revision.h | 4 +- 7 files changed, 397 insertions(+), 75 deletions(-)
Several miscellaneous features of rev-cache are introduced, and the non-commit object generation is refactored. Cache coagulation and index regeneration are added, allowing for cache slice maintenance and garbage collection. Commit and blob objects are modified to store object size, as the tree object does, and this parameter is instated upon parsing. Object enumeration makes use of this addition and more fluidly generates its list.
Tests for coagulation and index generation are added in the integration patch, as the former in its proper incarnation makes use of rev-cache's influence on the revision walker.
--- blob.c | 1 + blob.h | 1 + builtin-rev-cache.c | 49 ++++++- commit.c | 1 + commit.h | 1 + rev-cache.c | 415 ++++++++++++++++++++++++++++++++++++++++++--------- revision.h | 4 +- 7 files changed, 397 insertions(+), 75 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
@@ -247,6 +247,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 -73
588 lines not on this page · raw message
revision.h +3 -1
@@ -204,6 +204,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 ends_from_slices (struct rev_info *revs,unsigned int flags); +extern void ends_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
Signature · 1 line
tg: (3e132f7..) t/revcache/misc (depends on: t/revcache/objects)