]> git.ipfire.org Git - thirdparty/git.git/blobdiff - midx.c
Merge branch 'ma/list-object-filter-opt-msgfix'
[thirdparty/git.git] / midx.c
diff --git a/midx.c b/midx.c
index 0de42ffdfb22c630e5b28f4997aa558c01a44d79..da03c1449aa119b03a34605b72056b8727318eb6 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -10,6 +10,7 @@
 #include "progress.h"
 #include "trace2.h"
 #include "run-command.h"
+#include "repository.h"
 
 #define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
 #define MIDX_VERSION 1
@@ -398,15 +399,9 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
 {
        struct multi_pack_index *m;
        struct multi_pack_index *m_search;
-       int config_value;
-       static int env_value = -1;
 
-       if (env_value < 0)
-               env_value = git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0);
-
-       if (!env_value &&
-           (repo_config_get_bool(r, "core.multipackindex", &config_value) ||
-           !config_value))
+       prepare_repo_settings(r);
+       if (!r->settings.core_multi_pack_index)
                return 0;
 
        for (m_search = r->objects->multi_pack_index; m_search; m_search = m_search->next)
@@ -790,9 +785,7 @@ static size_t write_midx_large_offsets(struct hashfile *f, uint32_t nr_large_off
                if (!(offset >> 31))
                        continue;
 
-               hashwrite_be32(f, offset >> 32);
-               hashwrite_be32(f, offset & 0xffffffffUL);
-               written += 2 * sizeof(uint32_t);
+               written += hashwrite_be64(f, offset);
 
                nr_large_offset--;
        }
@@ -850,7 +843,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
 
        packs.pack_paths_checked = 0;
        if (flags & MIDX_PROGRESS)
-               packs.progress = start_progress(_("Adding packfiles to multi-pack-index"), 0);
+               packs.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0);
        else
                packs.progress = NULL;
 
@@ -980,14 +973,13 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
                            chunk_offsets[i]);
 
                hashwrite_be32(f, chunk_ids[i]);
-               hashwrite_be32(f, chunk_offsets[i] >> 32);
-               hashwrite_be32(f, chunk_offsets[i]);
+               hashwrite_be64(f, chunk_offsets[i]);
 
                written += MIDX_CHUNKLOOKUP_WIDTH;
        }
 
        if (flags & MIDX_PROGRESS)
-               progress = start_progress(_("Writing chunks to multi-pack-index"),
+               progress = start_delayed_progress(_("Writing chunks to multi-pack-index"),
                                          num_chunks);
        for (i = 0; i < num_chunks; i++) {
                if (written != chunk_offsets[i])
@@ -1129,7 +1121,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
        }
 
        if (flags & MIDX_PROGRESS)
-               progress = start_progress(_("Looking for referenced packfiles"),
+               progress = start_delayed_progress(_("Looking for referenced packfiles"),
                                          m->num_packs);
        for (i = 0; i < m->num_packs; i++) {
                if (prepare_midx_pack(r, m, i))
@@ -1250,7 +1242,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
        count = xcalloc(m->num_packs, sizeof(uint32_t));
 
        if (flags & MIDX_PROGRESS)
-               progress = start_progress(_("Counting referenced objects"),
+               progress = start_delayed_progress(_("Counting referenced objects"),
                                          m->num_objects);
        for (i = 0; i < m->num_objects; i++) {
                int pack_int_id = nth_midxed_pack_int_id(m, i);
@@ -1260,7 +1252,7 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
        stop_progress(&progress);
 
        if (flags & MIDX_PROGRESS)
-               progress = start_progress(_("Finding and deleting unreferenced packfiles"),
+               progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"),
                                          m->num_packs);
        for (i = 0; i < m->num_packs; i++) {
                char *pack_name;