Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r--pack-bitmap.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 107fc35fb2..ef580be9e3 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -112,7 +112,7 @@ static struct ewah_bitmap *lookup_stored_bitmap(struct stored_bitmap *st)
struct ewah_bitmap *parent;
struct ewah_bitmap *composed;
- if (st->xor == NULL)
+ if (!st->xor)
return st->root;
composed = ewah_pool_new();
@@ -280,7 +280,7 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
if (xor_offset > 0) {
xor_bitmap = recent_bitmaps[(i - xor_offset) % MAX_XOR_OFFSET];
- if (xor_bitmap == NULL)
+ if (!xor_bitmap)
return error(_("invalid XOR offset in bitmap pack index"));
}
@@ -316,6 +316,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
struct stat st;
char *bitmap_name = midx_bitmap_filename(midx);
int fd = git_open(bitmap_name);
+ uint32_t i;
+ struct packed_git *preferred;
if (fd < 0) {
if (errno != ENOENT)
@@ -360,6 +362,20 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
warning(_("multi-pack bitmap is missing required reverse index"));
goto cleanup;
}
+
+ for (i = 0; i < bitmap_git->midx->num_packs; i++) {
+ if (prepare_midx_pack(the_repository, bitmap_git->midx, i))
+ die(_("could not open pack %s"),
+ bitmap_git->midx->pack_names[i]);
+ }
+
+ preferred = bitmap_git->midx->packs[midx_preferred_pack(bitmap_git)];
+ if (!is_pack_valid(preferred)) {
+ warning(_("preferred pack (%s) is invalid"),
+ preferred->pack_name);
+ goto cleanup;
+ }
+
return 0;
cleanup:
@@ -441,8 +457,6 @@ static int load_reverse_index(struct bitmap_index *bitmap_git)
* since we will need to make use of them in pack-objects.
*/
for (i = 0; i < bitmap_git->midx->num_packs; i++) {
- if (prepare_midx_pack(the_repository, bitmap_git->midx, i))
- die(_("load_reverse_index: could not open pack"));
ret = load_pack_revindex(bitmap_git->midx->packs[i]);
if (ret)
return ret;
@@ -741,7 +755,7 @@ static int add_commit_to_bitmap(struct bitmap_index *bitmap_git,
if (!or_with)
return 0;
- if (*base == NULL)
+ if (!*base)
*base = ewah_to_bitmap(or_with);
else
bitmap_or_ewah(*base, or_with);
@@ -784,7 +798,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
* Best case scenario: We found bitmaps for all the roots,
* so the resulting `or` bitmap has the full reachability analysis
*/
- if (not_mapped == NULL)
+ if (!not_mapped)
return base;
roots = not_mapped;
@@ -818,7 +832,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
struct include_data incdata;
struct bitmap_show_data show_data;
- if (base == NULL)
+ if (!base)
base = bitmap_new();
incdata.bitmap_git = bitmap_git;
@@ -1312,7 +1326,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
reset_revision_walk();
revs->ignore_missing_links = 0;
- if (haves_bitmap == NULL)
+ if (!haves_bitmap)
BUG("failed to perform bitmap walk");
}
@@ -1711,7 +1725,7 @@ void test_bitmap_walk(struct rev_info *revs)
result = ewah_to_bitmap(bm);
}
- if (result == NULL)
+ if (!result)
die(_("commit '%s' doesn't have an indexed bitmap"), oid_to_hex(&root->oid));
revs->tag_objects = 1;