bare minimum revision cache system, no integration with git
PATCH 2/6 bare minimum revision cache system, no integration with git
Second in the revision cache series, this particular patch provides:
- minimal API: caching only commit topo data
- minimal porcelain: add and walk cache slices
- appropriate tests
Signed-off-by Nick Edelen <[email protected]>
--- Makefile | 2 + builtin-rev-cache.c | 206 +++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1074 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 89 ++++ revision.c | 2 +- revision.h | 26 +- t/t6015-rev-cache-list.sh | 104 +++++ 10 files changed, 1505 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -533,6 +533,7 @@ LIB_OBJS += reflog-walk.o LIB_OBJS += refs.o LIB_OBJS += remote.o LIB_OBJS += rerere.o +LIB_OBJS += rev-cache.o LIB_OBJS += revision.o LIB_OBJS += run-command.o LIB_OBJS += server-info.o
@@ -623,6 +624,7 @@ BUILTIN_OBJS += builtin-reflog.o BUILTIN_OBJS += builtin-remote.o BUILTIN_OBJS += builtin-rerere.o BUILTIN_OBJS += builtin-reset.o +BUILTIN_OBJS += builtin-rev-cache.o BUILTIN_OBJS += builtin-rev-list.o BUILTIN_OBJS += builtin-rev-parse.o BUILTIN_OBJS += builtin-revert.o
builtin-rev-cache.c new file +206 -0
206 lines not on this page · raw message
builtin.h +1 -0
@@ -87,6 +87,7 @@ extern int cmd_remote(int argc, const char **argv, const char *prefix);extern int cmd_config (int argc,const char **argv,const char *prefix);extern int cmd_rerere (int argc,const char **argv,const char *prefix);extern int cmd_reset (int argc,const char **argv,const char *prefix); +extern int cmd_rev_cache (int argc,const char **argv,const char *prefix);extern int cmd_rev_list (int argc,const char **argv,const char *prefix);extern int cmd_rev_parse (int argc,const char **argv,const char *prefix);extern int cmd_revert (int argc,const char **argv,const char *prefix);
commit.c +2 -0
@@ -252,6 +252,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size) item->tree =lookup_tree (parent); bufptr +=46 ;/* "tree " + "hex sha1" + "\n" */ pptr = &item->parents; +while (pop_commit (pptr)) + ;/* clear anything from cache */ graft =lookup_commit_graft (item->object.sha1);while (bufptr +48 < tail && !memcmp (bufptr,"parent " ,7 )) {
git.c +1 -0
@@ -342,6 +342,7 @@ static void handle_internal_command(int argc, const char **argv) { "repo-config", cmd_config }, { "rerere", cmd_rerere, RUN_SETUP }, { "reset", cmd_reset, RUN_SETUP }, + { "rev-cache", cmd_rev_cache, RUN_SETUP }, { "rev-list", cmd_rev_list, RUN_SETUP }, { "rev-parse", cmd_rev_parse }, { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
rev-cache.c new file +1074 -0
1,074 lines not on this page · raw message
rev-cache.h new file +89 -0
89 lines not on this page · raw message
revision.c +1 -1
@@ -432,7 +432,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) commit->object.flags |=TREESAME ; } -static void insert_by_date_cached (struct commit *p,struct commit_list **head, +void insert_by_date_cached (struct commit *p,struct commit_list **head,struct commit_list *cached_base,struct commit_list **cache) {struct commit_list *new_entry;
revision.h +25 -1
@@ -13,11 +13,25 @@#define CHILD_SHOWN (1u<<6)#define ADDED (1u<<7)/* Parents already parsed and added? */ #define SYMMETRIC_LEFT (1u<<8) -#define ALL_REV_FLAGS ((1u<<9)-1) +#define FACE_VALUE (1u<<9) +#define ALL_REV_FLAGS ((1u<<10)-1)struct rev_info ;struct log_info ; +struct rev_cache_info { +/* generation flags */ +unsigned objects :1 , + legs :1 , + make_index :1 ; + +/* traversal flags */ +unsigned add_to_pending :1 ; + +/* fuse options */ +unsigned int ignore_size; +}; +struct rev_info {/* Starting list */ struct commit_list *commits;
@@ -73,6 +87,10 @@ struct rev_info { dense_combined_merges:1 , always_show_header:1; +/* rev-cache flags */ + unsigned int for_pack:1, + dont_cache_me:1; +/* Format info */ unsigned int shown_one:1, show_merge:1,
@@ -116,6 +134,9 @@ struct rev_info {struct reflog_walk_info *reflog_info;struct decoration children;struct decoration merge_simplification; + +/* caching info, used ONLY by traverse_cache_slice */ +struct rev_cache_info rev_cache_info; };#define REV_TREE_SAME 0
@@ -167,4 +188,7 @@ enum commit_action {extern enum commit_action simplify_commit (struct rev_info *revs,struct commit *commit); +extern void insert_by_date_cached (struct commit *p,struct commit_list **head, +struct commit_list *cached_base,struct commit_list **cache); +#endif
t/t6015-rev-cache-list.sh new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
tg: (6ffd781..) t/revcache/basic (depends on: master)