Merge branch 'ew/repack-with-bitmaps-by-default'

The connectivity bitmaps are created by default in bare
repositories now; also the pathname hash-cache is created by
default to avoid making crappy deltas when repacking.

* ew/repack-with-bitmaps-by-default:
  pack-objects: default to writing bitmap hash-cache
  t5310: correctly remove bitmaps for jgit test
  repack: enable bitmaps by default on bare repos
This commit is contained in:
Junio C Hamano 2019-05-13 23:50:32 +09:00
commit 2bfb182bc5
8 changed files with 28 additions and 13 deletions

View file

@ -124,6 +124,4 @@ pack.writeBitmapHashCache::
bitmapped and non-bitmapped objects (e.g., when serving a fetch bitmapped and non-bitmapped objects (e.g., when serving a fetch
between an older, bitmapped pack and objects that have been between an older, bitmapped pack and objects that have been
pushed since the last gc). The downside is that it consumes 4 pushed since the last gc). The downside is that it consumes 4
bytes per object of disk space, and that JGit's bitmap bytes per object of disk space. Defaults to true.
implementation does not understand it, causing it to complain if
Git and JGit are used on the same repository. Defaults to false.

View file

@ -24,4 +24,4 @@ repack.writeBitmaps::
packs created for clones and fetches, at the cost of some disk packs created for clones and fetches, at the cost of some disk
space and extra time spent on the initial repack. This has space and extra time spent on the initial repack. This has
no effect if multiple packfiles are created. no effect if multiple packfiles are created.
Defaults to false. Defaults to true on bare repos, false otherwise.

View file

@ -97,7 +97,7 @@ static off_t reuse_packfile_offset;
static int use_bitmap_index_default = 1; static int use_bitmap_index_default = 1;
static int use_bitmap_index = -1; static int use_bitmap_index = -1;
static int write_bitmap_index; static int write_bitmap_index;
static uint16_t write_bitmap_options; static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;
static int exclude_promisor_objects; static int exclude_promisor_objects;

View file

@ -14,7 +14,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; static int write_bitmaps = -1;
static int use_delta_islands; static int use_delta_islands;
static char *packdir, *packtmp; static char *packdir, *packtmp;
@ -343,6 +343,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE))) (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)))
die(_("--keep-unreachable and -A are incompatible")); die(_("--keep-unreachable and -A are incompatible"));
if (write_bitmaps < 0)
write_bitmaps = (pack_everything & ALL_INTO_ONE) &&
is_bare_repository();
if (pack_kept_objects < 0) if (pack_kept_objects < 0)
pack_kept_objects = write_bitmaps; pack_kept_objects = write_bitmaps;

View file

@ -12,8 +12,7 @@ test_perf_large_repo
# We intentionally use the deprecated pack.writebitmaps # We intentionally use the deprecated pack.writebitmaps
# config so that we can test against older versions of git. # 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
' '
test_perf 'repack to disk' ' test_perf 'repack to disk' '

View file

@ -7,7 +7,6 @@ test_perf_default_repo
test_expect_success 'create bitmapped server repo' ' test_expect_success 'create bitmapped server repo' '
git config pack.writebitmaps true && git config pack.writebitmaps true &&
git config pack.writebitmaphashcache true &&
git repack -ad git repack -ad
' '

View file

@ -34,8 +34,7 @@ test_expect_success 'setup repo with moderate-sized history' '
bitmaptip=$(git rev-parse master) && bitmaptip=$(git rev-parse 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 repack.writebitmaps true && git config repack.writebitmaps true
git config pack.writebitmaphashcache true
' '
test_expect_success 'full repack creates bitmaps' ' test_expect_success 'full repack creates bitmaps' '
@ -269,7 +268,7 @@ test_expect_success JGIT 'we can read jgit bitmaps' '
git clone --bare . compat-jgit.git && git clone --bare . compat-jgit.git &&
( (
cd compat-jgit.git && cd compat-jgit.git &&
rm -f .git/objects/pack/*.bitmap && rm -f objects/pack/*.bitmap &&
jgit gc && jgit gc &&
git rev-list --test-bitmap HEAD git rev-list --test-bitmap HEAD
) )

View file

@ -221,5 +221,22 @@ test_expect_success 'repack --keep-pack' '
) )
' '
test_done test_expect_success 'bitmaps are created by default in bare repos' '
git clone --bare .git bare.git &&
git -C bare.git repack -ad &&
bitmap=$(ls bare.git/objects/pack/*.bitmap) &&
test_path_is_file "$bitmap"
'
test_expect_success 'incremental repack does not complain' '
git -C bare.git repack -q 2>repack.err &&
test_must_be_empty repack.err
'
test_expect_success 'bitmaps can be disabled on bare repos' '
git -c repack.writeBitmaps=false -C bare.git repack -ad &&
bitmap=$(ls bare.git/objects/pack/*.bitmap 2>/dev/null || :) &&
test -z "$bitmap"
'
test_done