basic revision cache system, no integration or features
PATCH 2/6 basic revision cache system, no integration or features
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
--- Makefile | 2 + builtin-rev-cache.c | 206 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1169 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6015-rev-cache-list.sh | 104 ++++ 10 files changed, 1618 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -537,6 +537,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
@@ -627,6 +628,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 +1169 -0
1,169 lines not on this page · raw message
rev-cache.h new file +107 -0
107 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: (64d5fe0..) t/revcache/basic (depends on: master)
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
--- Makefile | 2 + builtin-rev-cache.c | 207 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1171 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6015-rev-cache-list.sh | 104 ++++ 10 files changed, 1621 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -537,6 +537,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
@@ -627,6 +628,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 +207 -0
207 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 +1171 -0
1,171 lines not on this page · raw message
rev-cache.h new file +107 -0
107 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: (64d5fe0..) t/revcache/basic (depends on: master)
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
---
fixed a whitespace error.
Makefile | 2 + builtin-rev-cache.c | 207 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1171 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6015-rev-cache-list.sh | 104 ++++ 10 files changed, 1621 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -537,6 +537,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
@@ -627,6 +628,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 +207 -0
207 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 +1171 -0
1,171 lines not on this page · raw message
rev-cache.h new file +107 -0
107 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: (64d5fe0..) t/revcache/basic (depends on: master)
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
---
Renamed test file to t6017-... to avoid conflict with newly-introduced t6015-rev-list-show-all-parents.
Makefile | 2 + builtin-rev-cache.c | 207 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1171 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6017-rev-cache-list.sh | 112 +++++ 10 files changed, 1629 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -529,6 +529,7 @@ LIB_OBJS += refs.o LIB_OBJS += remote.o LIB_OBJS += replace_object.o LIB_OBJS += rerere.o +LIB_OBJS += rev-cache.o LIB_OBJS += revision.o LIB_OBJS += run-command.o LIB_OBJS += server-info.o
@@ -620,6 +621,7 @@ BUILTIN_OBJS += builtin-remote.o BUILTIN_OBJS += builtin-replace.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 +207 -0
207 lines not on this page · raw message
builtin.h +1 -0
@@ -86,6 +86,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
@@ -343,6 +343,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 +1171 -0
1,171 lines not on this page · raw message
rev-cache.h new file +107 -0
107 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,7 +13,8 @@#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)#define DECORATE_SHORT_REFS 1#define DECORATE_FULL_REFS 2
@@ -21,6 +22,19 @@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;
@@ -76,6 +90,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,
@@ -119,6 +137,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
@@ -171,4 +192,7 @@ enum commit_action {extern enum commit_action get_commit_action (struct rev_info *revs,struct commit *commit);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/t6017-rev-cache-list.sh new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
tg: (6ea71fe..) t/revcache/basic (depends on: master)
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
---
removed useless test.
Makefile | 2 + builtin-rev-cache.c | 207 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1171 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6017-rev-cache-list.sh | 106 ++++ 10 files changed, 1623 insertions(+), 2 deletions(-)
Makefile +2 -0
@@ -534,6 +534,7 @@ LIB_OBJS += refs.o LIB_OBJS += remote.o LIB_OBJS += replace_object.o LIB_OBJS += rerere.o +LIB_OBJS += rev-cache.o LIB_OBJS += revision.o LIB_OBJS += run-command.o LIB_OBJS += server-info.o
@@ -626,6 +627,7 @@ BUILTIN_OBJS += builtin-remote.o BUILTIN_OBJS += builtin-replace.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 +207 -0
207 lines not on this page · raw message
builtin.h +1 -0
@@ -86,6 +86,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
@@ -343,6 +343,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 +1171 -0
1,171 lines not on this page · raw message
rev-cache.h new file +107 -0
107 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,7 +13,8 @@#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)#define DECORATE_SHORT_REFS 1#define DECORATE_FULL_REFS 2
@@ -21,6 +22,19 @@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;
@@ -76,6 +90,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,
@@ -119,6 +137,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
@@ -171,4 +192,7 @@ enum commit_action {extern enum commit_action get_commit_action (struct rev_info *revs,struct commit *commit);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/t6017-rev-cache-list.sh new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
tg: (a6dbf88..) t/revcache/basic (depends on: master)
The entire series is unusable due to whitespace breakage.
Quoted 1 line
The entire series is unusable due to whitespace breakage.
Shit sorry about that. I think my mail client reset some settings when I upgraded. Will resend.
I feel like such a klutz...
Heya,
Quoted 1 line · Nick Edelen
1618 insertions(+)
Really?
Signature · 3 lines
Cheers, Sverre Rabbelier
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
---
removed useless test. sorry about large size: this is less of a patch and more an addition of two files.
Makefile | 2 + builtin-rev-cache.c | 207 ++++++++ builtin.h | 1 + commit.c | 2 + git.c | 1 + rev-cache.c | 1171 +++++++++++++++++++++++++++++++++++++++++++++ rev-cache.h | 107 ++++ revision.c | 2 +- revision.h | 26 +- t/t6017-rev-cache-list.sh | 106 ++++ 10 files changed, 1623 insertions(+), 2 deletions(-)
Makefile +0 -0
@@ -538,6 +538,7 @@ LIB_OBJS += refs.o
LIB_OBJS += remote.oLIB_OBJS += replace_object.oLIB_OBJS += rerere.o
+LIB_OBJS += rev-cache.oLIB_OBJS += revision.oLIB_OBJS += run-command.oLIB_OBJS += server-info.o
@@ -630,6 +631,7 @@ BUILTIN_OBJS += builtin-remote.o BUILTIN_OBJS += builtin-replace.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 +207 -0
207 lines not on this page · raw message
builtin.h +0 -0
@@ -86,6 +86,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 +0 -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 +0 -0
@@ -345,6 +345,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 +1171 -0
1,171 lines not on this page · raw message
rev-cache.h new file +107 -0
107 lines not on this page · raw message
revision.c +0 -0
@@ -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 +0 -0
@@ -13,7 +13,8 @@
#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)
#define DECORATE_SHORT_REFS 1
#define DECORATE_FULL_REFS 2
@@ -21,6 +22,19 @@
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;
@@ -76,6 +90,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,
@@ -120,6 +138,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
@@ -172,4 +193,7 @@ enum commit_action {
extern enum commit_action get_commit_action(struct rev_info *revs, struct commit *commit); 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/t6017-rev-cache-list.sh new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
tg: (e79999b..) t/revcache/basic (depends on: master)