mirror of
https://github.com/git/git
synced 2024-08-28 20:20:07 +00:00
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:
commit
2bfb182bc5
|
@ -124,6 +124,4 @@ pack.writeBitmapHashCache::
|
|||
bitmapped and non-bitmapped objects (e.g., when serving a fetch
|
||||
between an older, bitmapped pack and objects that have been
|
||||
pushed since the last gc). The downside is that it consumes 4
|
||||
bytes per object of disk space, and that JGit's bitmap
|
||||
implementation does not understand it, causing it to complain if
|
||||
Git and JGit are used on the same repository. Defaults to false.
|
||||
bytes per object of disk space. Defaults to true.
|
||||
|
|
|
@ -24,4 +24,4 @@ repack.writeBitmaps::
|
|||
packs created for clones and fetches, at the cost of some disk
|
||||
space and extra time spent on the initial repack. This has
|
||||
no effect if multiple packfiles are created.
|
||||
Defaults to false.
|
||||
Defaults to true on bare repos, false otherwise.
|
||||
|
|
|
@ -97,7 +97,7 @@ static off_t reuse_packfile_offset;
|
|||
static int use_bitmap_index_default = 1;
|
||||
static int use_bitmap_index = -1;
|
||||
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;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
static int delta_base_offset = 1;
|
||||
static int pack_kept_objects = -1;
|
||||
static int write_bitmaps;
|
||||
static int write_bitmaps = -1;
|
||||
static int use_delta_islands;
|
||||
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)))
|
||||
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)
|
||||
pack_kept_objects = write_bitmaps;
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ test_perf_large_repo
|
|||
# We intentionally use the deprecated pack.writebitmaps
|
||||
# config so that we can test against older versions of git.
|
||||
test_expect_success 'setup bitmap config' '
|
||||
git config pack.writebitmaps true &&
|
||||
git config pack.writebitmaphashcache true
|
||||
git config pack.writebitmaps true
|
||||
'
|
||||
|
||||
test_perf 'repack to disk' '
|
||||
|
|
|
@ -7,7 +7,6 @@ test_perf_default_repo
|
|||
|
||||
test_expect_success 'create bitmapped server repo' '
|
||||
git config pack.writebitmaps true &&
|
||||
git config pack.writebitmaphashcache true &&
|
||||
git repack -ad
|
||||
'
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@ test_expect_success 'setup repo with moderate-sized history' '
|
|||
bitmaptip=$(git rev-parse master) &&
|
||||
blob=$(echo tagged-blob | git hash-object -w --stdin) &&
|
||||
git tag tagged-blob $blob &&
|
||||
git config repack.writebitmaps true &&
|
||||
git config pack.writebitmaphashcache true
|
||||
git config repack.writebitmaps true
|
||||
'
|
||||
|
||||
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 &&
|
||||
(
|
||||
cd compat-jgit.git &&
|
||||
rm -f .git/objects/pack/*.bitmap &&
|
||||
rm -f objects/pack/*.bitmap &&
|
||||
jgit gc &&
|
||||
git rev-list --test-bitmap HEAD
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue