Merge branch 'jk/repack-pack-writebitmaps-config'

* jk/repack-pack-writebitmaps-config:
  t7700: drop explicit --no-pack-kept-objects from .keep test
  repack: introduce repack.writeBitmaps config option
  repack: simplify handling of --write-bitmap-index
  pack-objects: stop respecting pack.writebitmaps
This commit is contained in:
Junio C Hamano 2014-06-25 12:23:19 -07:00
Родитель b30adaac52 2d0174e38e
Коммит 25f3119000
6 изменённых файлов: 22 добавлений и 20 удалений

Просмотреть файл

@ -1905,12 +1905,7 @@ pack.useBitmaps::
you are debugging pack bitmaps. you are debugging pack bitmaps.
pack.writebitmaps:: pack.writebitmaps::
When true, git will write a bitmap index when packing all This is a deprecated synonym for `repack.writeBitmaps`.
objects to disk (e.g., when `git repack -a` is run). This
index can speed up the "counting objects" phase of subsequent
packs created for clones and fetches, at the cost of some disk
space and extra time spent on the initial repack. Defaults to
false.
pack.writeBitmapHashCache:: pack.writeBitmapHashCache::
When true, git will include a "hash cache" section in the bitmap When true, git will include a "hash cache" section in the bitmap
@ -2187,7 +2182,15 @@ repack.packKeptObjects::
`--pack-kept-objects` was passed. See linkgit:git-repack[1] for `--pack-kept-objects` was passed. See linkgit:git-repack[1] for
details. Defaults to `false` normally, but `true` if a bitmap details. Defaults to `false` normally, but `true` if a bitmap
index is being written (either via `--write-bitmap-index` or index is being written (either via `--write-bitmap-index` or
`pack.writeBitmaps`). `repack.writeBitmaps`).
repack.writeBitmaps::
When true, git will write a bitmap index when packing all
objects to disk (e.g., when `git repack -a` is run). This
index can speed up the "counting objects" phase of subsequent
packs created for clones and fetches, at the cost of some disk
space and extra time spent on the initial repack. Defaults to
false.
rerere.autoupdate:: rerere.autoupdate::
When set to true, `git-rerere` updates the index with the When set to true, `git-rerere` updates the index with the

Просмотреть файл

@ -2214,10 +2214,6 @@ static int git_pack_config(const char *k, const char *v, void *cb)
cache_max_small_delta_size = git_config_int(k, v); cache_max_small_delta_size = git_config_int(k, v);
return 0; return 0;
} }
if (!strcmp(k, "pack.writebitmaps")) {
write_bitmap_index = git_config_bool(k, v);
return 0;
}
if (!strcmp(k, "pack.writebitmaphashcache")) { if (!strcmp(k, "pack.writebitmaphashcache")) {
if (git_config_bool(k, v)) if (git_config_bool(k, v))
write_bitmap_options |= BITMAP_OPT_HASH_CACHE; write_bitmap_options |= BITMAP_OPT_HASH_CACHE;

Просмотреть файл

@ -10,7 +10,7 @@
static int delta_base_offset = 1; static int delta_base_offset = 1;
static int pack_kept_objects = -1; static int pack_kept_objects = -1;
static int write_bitmaps = -1; static int write_bitmaps;
static char *packdir, *packtmp; static char *packdir, *packtmp;
static const char *const git_repack_usage[] = { static const char *const git_repack_usage[] = {
@ -28,7 +28,8 @@ static int repack_config(const char *var, const char *value, void *cb)
pack_kept_objects = git_config_bool(var, value); pack_kept_objects = git_config_bool(var, value);
return 0; return 0;
} }
if (!strcmp(var, "pack.writebitmaps")) { if (!strcmp(var, "repack.writebitmaps") ||
!strcmp(var, "pack.writebitmaps")) {
write_bitmaps = git_config_bool(var, value); write_bitmaps = git_config_bool(var, value);
return 0; return 0;
} }
@ -195,7 +196,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
git_repack_usage, 0); git_repack_usage, 0);
if (pack_kept_objects < 0) if (pack_kept_objects < 0)
pack_kept_objects = write_bitmaps > 0; pack_kept_objects = write_bitmaps;
packdir = mkpathdup("%s/pack", get_object_directory()); packdir = mkpathdup("%s/pack", get_object_directory());
packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid()); packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
@ -221,9 +222,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
argv_array_pushf(&cmd_args, "--no-reuse-delta"); argv_array_pushf(&cmd_args, "--no-reuse-delta");
if (no_reuse_object) if (no_reuse_object)
argv_array_pushf(&cmd_args, "--no-reuse-object"); argv_array_pushf(&cmd_args, "--no-reuse-object");
if (write_bitmaps >= 0) if (write_bitmaps)
argv_array_pushf(&cmd_args, "--%swrite-bitmap-index", argv_array_push(&cmd_args, "--write-bitmap-index");
write_bitmaps ? "" : "no-");
if (pack_everything & ALL_INTO_ONE) { if (pack_everything & ALL_INTO_ONE) {
get_non_kept_pack_filenames(&existing_packs); get_non_kept_pack_filenames(&existing_packs);

Просмотреть файл

@ -8,6 +8,9 @@ test_perf_large_repo
# note that we do everything through config, # note that we do everything through config,
# since we want to be able to compare bitmap-aware # since we want to be able to compare bitmap-aware
# git versus non-bitmap git # git versus non-bitmap git
#
# We intentionally use the deprecated pack.writebitmaps
# config so that we can test against older versions of git.
test_expect_success 'setup bitmap config' ' test_expect_success 'setup bitmap config' '
git config pack.writebitmaps true && git config pack.writebitmaps true &&
git config pack.writebitmaphashcache true git config pack.writebitmaphashcache true

Просмотреть файл

@ -18,7 +18,7 @@ test_expect_success 'setup repo with moderate-sized history' '
git checkout master && git checkout master &&
blob=$(echo tagged-blob | git hash-object -w --stdin) && blob=$(echo tagged-blob | git hash-object -w --stdin) &&
git tag tagged-blob $blob && git tag tagged-blob $blob &&
git config pack.writebitmaps true && git config repack.writebitmaps true &&
git config pack.writebitmaphashcache true git config pack.writebitmaphashcache true
' '

Просмотреть файл

@ -21,7 +21,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 | objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 |
sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") && sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") &&
mv pack-* .git/objects/pack/ && mv pack-* .git/objects/pack/ &&
git repack --no-pack-kept-objects -A -d -l && git repack -A -d -l &&
git prune-packed && git prune-packed &&
for p in .git/objects/pack/*.idx; do for p in .git/objects/pack/*.idx; do
idx=$(basename $p) idx=$(basename $p)
@ -53,7 +53,7 @@ test_expect_success 'writing bitmaps via command-line can duplicate .keep object
test_expect_success 'writing bitmaps via config can duplicate .keep objects' ' test_expect_success 'writing bitmaps via config can duplicate .keep objects' '
# build on $objsha1, $packsha1, and .keep state from previous # build on $objsha1, $packsha1, and .keep state from previous
git -c pack.writebitmaps=true repack -Adl && git -c repack.writebitmaps=true repack -Adl &&
test_when_finished "found_duplicate_object=" && test_when_finished "found_duplicate_object=" &&
for p in .git/objects/pack/*.idx; do for p in .git/objects/pack/*.idx; do
idx=$(basename $p) idx=$(basename $p)