Merge branch 'jk/pack-bitmap'
Borrow the bitmap index into packfiles from JGit to speed up enumeration of objects involved in a commit range without having to fully traverse the history. * jk/pack-bitmap: (26 commits) ewah: unconditionally ntohll ewah data ewah: support platforms that require aligned reads read-cache: use get_be32 instead of hand-rolled ntoh_l block-sha1: factor out get_be and put_be wrappers do not discard revindex when re-preparing packfiles pack-bitmap: implement optional name_hash cache t/perf: add tests for pack bitmaps t: add basic bitmap functionality tests count-objects: recognize .bitmap in garbage-checking repack: consider bitmaps when performing repacks repack: handle optional files created by pack-objects repack: turn exts array into array-of-struct repack: stop using magic number for ARRAY_SIZE(exts) pack-objects: implement bitmap writing rev-list: add bitmap mode to speed up object lists pack-objects: use bitmaps when packing objects pack-objects: split add_object_entry pack-bitmap: add support for bitmap indexes documentation: add documentation for the bitmap format ewah: compressed bitmap implementation ...
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
#include "diff.h"
|
||||
#include "revision.h"
|
||||
#include "list-objects.h"
|
||||
#include "pack.h"
|
||||
#include "pack-bitmap.h"
|
||||
#include "builtin.h"
|
||||
#include "log-tree.h"
|
||||
#include "graph.h"
|
||||
@ -257,6 +259,18 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int show_object_fast(
|
||||
const unsigned char *sha1,
|
||||
enum object_type type,
|
||||
int exclude,
|
||||
uint32_t name_hash,
|
||||
struct packed_git *found_pack,
|
||||
off_t found_offset)
|
||||
{
|
||||
fprintf(stdout, "%s\n", sha1_to_hex(sha1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct rev_info revs;
|
||||
@ -265,6 +279,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
int bisect_list = 0;
|
||||
int bisect_show_vars = 0;
|
||||
int bisect_find_all = 0;
|
||||
int use_bitmap_index = 0;
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
init_revisions(&revs, prefix);
|
||||
@ -306,6 +321,14 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
bisect_show_vars = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--use-bitmap-index")) {
|
||||
use_bitmap_index = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--test-bitmap")) {
|
||||
test_bitmap_walk(&revs);
|
||||
return 0;
|
||||
}
|
||||
usage(rev_list_usage);
|
||||
|
||||
}
|
||||
@ -333,6 +356,22 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||
if (bisect_list)
|
||||
revs.limited = 1;
|
||||
|
||||
if (use_bitmap_index) {
|
||||
if (revs.count && !revs.left_right && !revs.cherry_mark) {
|
||||
uint32_t commit_count;
|
||||
if (!prepare_bitmap_walk(&revs)) {
|
||||
count_bitmap_commit_list(&commit_count, NULL, NULL, NULL);
|
||||
printf("%d\n", commit_count);
|
||||
return 0;
|
||||
}
|
||||
} else if (revs.tag_objects && revs.tree_objects && revs.blob_objects) {
|
||||
if (!prepare_bitmap_walk(&revs)) {
|
||||
traverse_bitmap_commit_list(&show_object_fast);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prepare_revision_walk(&revs))
|
||||
die("revision walk setup failed");
|
||||
if (revs.tree_objects)
|
||||
|
Reference in New Issue
Block a user