full integration of rev-cache into git's revision walker, completed test suite
PATCH 5/6 full integration of rev-cache into git's revision walker, completed test suite
This last patch provides a working integration of rev-cache into the revision walker, along with some touch-ups:
- integration into revision walker and list-objects
- addition of 'unique' field to commit objects, optionally initialized in rev-cache with the objects introduced in that commit
- tweak of object generation to take advantage of the 'unique' field
- more fluid handling of damaged cache slices
- numerous tests for both features from the previous patch, and the
integration's integrity
'Integration' is rather broad -- a more detailed description follows for each aspect:
- rev-cache
the traversal mechanism is updated to handle many of the non-prune options rev-list does (date limiting, slop-handling, etc.), and is adjusted to allow for non-fatal cache-traversal failures.
- revision walker
both limited and unlimited traversal attempt to use the cache when possible, smoothly falling back if it's not.
- list-objects
object listing does not recurse into cached trees, and has been adjusted to guarantee commit-tag-tree-blob ordering.
--- builtin-rev-cache.c | 40 ++++++++ list-objects.c | 49 +++++++++-- rev-cache.c | 223 ++++++++++++++++++++++++++++++++++++++++----- revision.c | 87 ++++++++++++++--- t/t6015-rev-cache-list.sh | 151 +++++++++++++++++++++++++++++- 5 files changed, 499 insertions(+), 51 deletions(-)
builtin-rev-cache.c +40 -0
@@ -4,6 +4,7 @@#include "diff.h" #include "revision.h" #include "rev-cache.h" +#include "list-objects.h" unsigned long default_ignore_size =50 *1024 *1024 ;/* 50mb */
@@ -78,6 +79,43 @@ static int handle_add(int argc, const char *argv[]) /* args beyond this commandreturn 0 ; } +static void show_commit (struct commit *commit,void *data) +{ +printf ("%s\n" ,sha1_to_hex (commit->object.sha1)); +} + +static void show_object (struct object *obj,const struct name_path *path,const char *last) +{ +printf ("%s\n" ,sha1_to_hex (obj->sha1)); +} + +static int test_rev_list (int argc,const char *argv[]) +{ +struct rev_info revs; +unsigned int flags =0 ; +int i; + +init_revisions (&revs,0 ); + +for (i =0 ; i < argc; i++) { +if (!strcmp (argv[i],"--not" )) + flags ^=UNINTERESTING ; +else if (!strcmp (argv[i],"--objects" )) + revs.tree_objects = revs.blob_objects =1 ; +else +handle_revision_arg (argv[i], &revs, flags,1 ); + } + +setup_revisions (0 ,0 , &revs,0 ); + revs.topo_order =1 ; + revs.lifo =1 ; +prepare_revision_walk (&revs); + +traverse_commit_list (&revs, show_commit, show_object,0 ); + +return 0 ; +} +static int handle_walk (int argc,const char *argv[]) {struct commit *commit;
@@ -270,6 +308,8 @@ int cmd_rev_cache(int argc, const char *argv[], const char *prefix) r =handle_walk (argc, argv); else if (!strcmp(arg, "index")) r =handle_index (argc, argv); + else if (!strcmp(arg, "test")) + r =test_rev_list (argc, argv); else if (!strcmp(arg, "alt")) r =handle_alt (argc, argv); else
list-objects.c +42 -7
93 lines not on this page · raw message
rev-cache.c +201 -22
381 lines not on this page · raw message
revision.c +71 -16
136 lines not on this page · raw message
t/t6015-rev-cache-list.sh +145 -6
187 lines not on this page · raw message
Signature · 1 line
tg: (fbe850f..) t/revcache/integration (depends on: t/revcache/misc)