]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tl/pack-bitmap-error-messages'
authorJunio C Hamano <gitster@pobox.com>
Wed, 27 Jul 2022 16:16:52 +0000 (09:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Jul 2022 16:16:52 +0000 (09:16 -0700)
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

1  2 
pack-bitmap.c

diff --cc pack-bitmap.c
index 36134222d7a00acc1ebf5d52b3c3d817c10af8e9,107fc35fb23da01cf5249144089040b342cb17fe..ef580be9e3ff151b5941cd8c6a26cee9a859ed09
@@@ -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;