From: Junio C Hamano Date: Wed, 27 Jul 2022 16:16:52 +0000 (-0700) Subject: Merge branch 'tl/pack-bitmap-error-messages' X-Git-Tag: v2.38.0-rc0~128 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc29f890329d1ddc3d204fb8623971bdeddc0dbe;p=thirdparty%2Fgit.git Merge branch 'tl/pack-bitmap-error-messages' Tweak various messages that come from the pack-bitmap codepaths. * tl/pack-bitmap-error-messages: pack-bitmap.c: continue looping when first MIDX bitmap is found pack-bitmap.c: using error() instead of silently returning -1 pack-bitmap.c: do not ignore error when opening a bitmap file pack-bitmap.c: rename "idx_name" to "bitmap_name" pack-bitmap.c: mark more strings for translations pack-bitmap.c: fix formatting of error messages --- cc29f890329d1ddc3d204fb8623971bdeddc0dbe diff --cc pack-bitmap.c index 36134222d7,107fc35fb2..ef580be9e3 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@@ -279,8 -280,8 +280,8 @@@ static int load_bitmap_entries_v1(struc 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"); + return error(_("invalid XOR offset in bitmap pack index")); } recent_bitmaps[i % MAX_XOR_OFFSET] = store_bitmap( @@@ -313,17 -314,19 +314,21 @@@ static int open_midx_bitmap_1(struct bi struct multi_pack_index *midx) { struct stat st; - char *idx_name = midx_bitmap_filename(midx); - int fd = git_open(idx_name); + char *bitmap_name = midx_bitmap_filename(midx); + int fd = git_open(bitmap_name); + uint32_t i; + struct packed_git *preferred; - free(idx_name); - - if (fd < 0) + if (fd < 0) { + if (errno != ENOENT) + warning_errno("cannot open '%s'", bitmap_name); + free(bitmap_name); return -1; + } + free(bitmap_name); if (fstat(fd, &st)) { + error_errno(_("cannot fstat bitmap file")); close(fd); return -1; } @@@ -1712,8 -1711,8 +1725,8 @@@ void test_bitmap_walk(struct rev_info * result = ewah_to_bitmap(bm); } - if (result == NULL) + if (!result) - die("Commit %s doesn't have an indexed bitmap", oid_to_hex(&root->oid)); + die(_("commit '%s' doesn't have an indexed bitmap"), oid_to_hex(&root->oid)); revs->tag_objects = 1; revs->tree_objects = 1;