Merge branch 'ew/repack-with-bitmaps-by-default'
authorJunio C Hamano <gitster@pobox.com>
Mon, 13 May 2019 14:50:32 +0000 (23:50 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 May 2019 14:50:32 +0000 (23:50 +0900)
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

Documentation/config/pack.txt
Documentation/config/repack.txt
builtin/pack-objects.c
builtin/repack.c
t/perf/p5310-pack-bitmaps.sh
t/perf/p5311-pack-bitmaps-fetch.sh
t/t5310-pack-bitmaps.sh
t/t7700-repack.sh
index 425c73aa521a67f87941bd8fc11c69b52432cb00..9cdcfa7324784299f431d94b5237cc136aa585d1 100644 (file)
@@ -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.
index a5c37813fdad63791d2be8b09bc2ef128fd4a37e..9c413e177e02c6f28865ed79d84de3c5ccf43dd9 100644 (file)
@@ -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.
index d7743f110bce610a20fd7089d8181a8c36f60e80..9f424aababe6beacec572d6ef7dcd3b5fa18de44 100644 (file)
@@ -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;
 
index 67f8978043a43988d653092f83f21bd5baad9751..caca11392713eb92816d1e503f286bfe0d9be78a 100644 (file)
@@ -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;
 
index bb91dbb173dd01bfbfc11f867f0fcfc355db6822..6a3a42531b056285ac3a42cabe97c41146fa4291 100755 (executable)
@@ -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' '
index b04575951f51ea1a41229aa7a17643aa0380dbf5..47c3fd7581cc99d562bb5796f3374e207573a304 100755 (executable)
@@ -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
 '
 
index 82d7f7f6a5bbdc5609e0b76c97a3ae14f6a53a92..a26c8ba9a2b1b815e1917f703cb3520a7608d624 100755 (executable)
@@ -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
        )
index 6162e2a8e66f6f0e42e0a8ba6ee3b728e8e84918..86d05160a3589cefd7ad21dbf64c655658f26342 100755 (executable)
@@ -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