1
1
#include "cache.h"
2
2
#include "commit.h"
3
+ #include "strbuf.h"
3
4
#include "tag.h"
4
5
#include "diff.h"
5
6
#include "revision.h"
@@ -138,7 +139,7 @@ static struct ewah_bitmap *read_bitmap_1(struct bitmap_index *index)
138
139
index -> map_size - index -> map_pos );
139
140
140
141
if (bitmap_size < 0 ) {
141
- error ("Failed to load bitmap index (corrupted?)" );
142
+ error ("failed to load bitmap index (corrupted?)" );
142
143
ewah_pool_free (b );
143
144
return NULL ;
144
145
}
@@ -160,14 +161,14 @@ static int load_bitmap_header(struct bitmap_index *index)
160
161
size_t header_size = sizeof (* header ) - GIT_MAX_RAWSZ + the_hash_algo -> rawsz ;
161
162
162
163
if (index -> map_size < header_size + the_hash_algo -> rawsz )
163
- return error ("Corrupted bitmap index (too small)" );
164
+ return error ("corrupted bitmap index (too small)" );
164
165
165
166
if (memcmp (header -> magic , BITMAP_IDX_SIGNATURE , sizeof (BITMAP_IDX_SIGNATURE )) != 0 )
166
- return error ("Corrupted bitmap index file (wrong header)" );
167
+ return error ("corrupted bitmap index file (wrong header)" );
167
168
168
169
index -> version = ntohs (header -> version );
169
170
if (index -> version != 1 )
170
- return error ("Unsupported version for bitmap index file (%d) " , index -> version );
171
+ return error ("unsupported version '%d' for bitmap index file" , index -> version );
171
172
172
173
/* Parse known bitmap format options */
173
174
{
@@ -176,7 +177,7 @@ static int load_bitmap_header(struct bitmap_index *index)
176
177
unsigned char * index_end = index -> map + index -> map_size - the_hash_algo -> rawsz ;
177
178
178
179
if ((flags & BITMAP_OPT_FULL_DAG ) == 0 )
179
- return error ( "Unsupported options for bitmap index file "
180
+ BUG ( "unsupported options for bitmap index file "
180
181
"(Git requires BITMAP_OPT_FULL_DAG)" );
181
182
182
183
if (flags & BITMAP_OPT_HASH_CACHE ) {
@@ -215,7 +216,7 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
215
216
* because the SHA1 already existed on the map. this is bad, there
216
217
* shouldn't be duplicated commits in the index */
217
218
if (ret == 0 ) {
218
- error ("Duplicate entry in bitmap index: %s " , oid_to_hex (oid ));
219
+ error ("duplicate entry in bitmap index: '%s' " , oid_to_hex (oid ));
219
220
return NULL ;
220
221
}
221
222
@@ -274,13 +275,13 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
274
275
return -1 ;
275
276
276
277
if (xor_offset > MAX_XOR_OFFSET || xor_offset > i )
277
- return error ("Corrupted bitmap pack index" );
278
+ return error ("corrupted bitmap pack index" );
278
279
279
280
if (xor_offset > 0 ) {
280
281
xor_bitmap = recent_bitmaps [(i - xor_offset ) % MAX_XOR_OFFSET ];
281
282
282
283
if (xor_bitmap == NULL )
283
- return error ("Invalid XOR offset in bitmap pack index" );
284
+ return error ("invalid XOR offset in bitmap pack index" );
284
285
}
285
286
286
287
recent_bitmaps [i % MAX_XOR_OFFSET ] = store_bitmap (
@@ -330,7 +331,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
330
331
struct strbuf buf = STRBUF_INIT ;
331
332
get_midx_filename (& buf , midx -> object_dir );
332
333
/* ignore extra bitmap file; we can only handle one */
333
- warning ("ignoring extra bitmap file: %s " , buf .buf );
334
+ warning ("ignoring extra bitmap file: '%s' " , buf .buf );
334
335
close (fd );
335
336
strbuf_release (& buf );
336
337
return -1 ;
@@ -387,7 +388,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
387
388
388
389
if (bitmap_git -> pack || bitmap_git -> midx ) {
389
390
/* ignore extra bitmap file; we can only handle one */
390
- warning ("ignoring extra bitmap file: %s " , packfile -> pack_name );
391
+ warning ("ignoring extra bitmap file: '%s' " , packfile -> pack_name );
391
392
close (fd );
392
393
return -1 ;
393
394
}
@@ -1626,15 +1627,15 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
1626
1627
}
1627
1628
1628
1629
if (bitmap_type == OBJ_NONE )
1629
- die ("object %s not found in type bitmaps" ,
1630
+ die ("object '%s' not found in type bitmaps" ,
1630
1631
oid_to_hex (& obj -> oid ));
1631
1632
1632
1633
if (bitmaps_nr > 1 )
1633
- die ("object %s does not have a unique type" ,
1634
+ die ("object '%s' does not have a unique type" ,
1634
1635
oid_to_hex (& obj -> oid ));
1635
1636
1636
1637
if (bitmap_type != obj -> type )
1637
- die ("object %s : real type %s , expected: %s " ,
1638
+ die ("object '%s' : real type '%s' , expected: '%s' " ,
1638
1639
oid_to_hex (& obj -> oid ),
1639
1640
type_name (obj -> type ),
1640
1641
type_name (bitmap_type ));
@@ -1648,7 +1649,7 @@ static void test_show_object(struct object *object, const char *name,
1648
1649
1649
1650
bitmap_pos = bitmap_position (tdata -> bitmap_git , & object -> oid );
1650
1651
if (bitmap_pos < 0 )
1651
- die ("Object not in bitmap: %s\n " , oid_to_hex (& object -> oid ));
1652
+ die ("object not in bitmap: '%s' " , oid_to_hex (& object -> oid ));
1652
1653
test_bitmap_type (tdata , object , bitmap_pos );
1653
1654
1654
1655
bitmap_set (tdata -> base , bitmap_pos );
@@ -1663,7 +1664,7 @@ static void test_show_commit(struct commit *commit, void *data)
1663
1664
bitmap_pos = bitmap_position (tdata -> bitmap_git ,
1664
1665
& commit -> object .oid );
1665
1666
if (bitmap_pos < 0 )
1666
- die ("Object not in bitmap: %s\n " , oid_to_hex (& commit -> object .oid ));
1667
+ die ("object not in bitmap: '%s' " , oid_to_hex (& commit -> object .oid ));
1667
1668
test_bitmap_type (tdata , & commit -> object , bitmap_pos );
1668
1669
1669
1670
bitmap_set (tdata -> base , bitmap_pos );
@@ -1685,21 +1686,21 @@ void test_bitmap_walk(struct rev_info *revs)
1685
1686
if (revs -> pending .nr != 1 )
1686
1687
die ("you must specify exactly one commit to test" );
1687
1688
1688
- fprintf (stderr , "Bitmap v%d test (%d entries loaded)\n " ,
1689
+ fprintf_ln (stderr , "Bitmap v%d test (%d entries loaded)" ,
1689
1690
bitmap_git -> version , bitmap_git -> entry_count );
1690
1691
1691
1692
root = revs -> pending .objects [0 ].item ;
1692
1693
bm = bitmap_for_commit (bitmap_git , (struct commit * )root );
1693
1694
1694
1695
if (bm ) {
1695
- fprintf (stderr , "Found bitmap for %s . %d bits / %08x checksum\n " ,
1696
+ fprintf_ln (stderr , "Found bitmap for '%s' . %d bits / %08x checksum" ,
1696
1697
oid_to_hex (& root -> oid ), (int )bm -> bit_size , ewah_checksum (bm ));
1697
1698
1698
1699
result = ewah_to_bitmap (bm );
1699
1700
}
1700
1701
1701
1702
if (result == NULL )
1702
- die ("Commit %s doesn't have an indexed bitmap" , oid_to_hex (& root -> oid ));
1703
+ die ("commit '%s' doesn't have an indexed bitmap" , oid_to_hex (& root -> oid ));
1703
1704
1704
1705
revs -> tag_objects = 1 ;
1705
1706
revs -> tree_objects = 1 ;
@@ -1724,7 +1725,7 @@ void test_bitmap_walk(struct rev_info *revs)
1724
1725
stop_progress (& tdata .prg );
1725
1726
1726
1727
if (bitmap_equals (result , tdata .base ))
1727
- fprintf (stderr , "OK!\n " );
1728
+ fprintf_ln (stderr , "OK!" );
1728
1729
else
1729
1730
die ("mismatch in bitmap results" );
1730
1731
@@ -1747,7 +1748,7 @@ int test_bitmap_commits(struct repository *r)
1747
1748
die ("failed to load bitmap indexes" );
1748
1749
1749
1750
kh_foreach (bitmap_git -> bitmaps , oid , value , {
1750
- printf ("%s\n " , oid_to_hex (& oid ));
1751
+ printf_ln ("%s" , oid_to_hex (& oid ));
1751
1752
});
1752
1753
1753
1754
free_bitmap_index (bitmap_git );
@@ -1772,7 +1773,7 @@ int test_bitmap_hashes(struct repository *r)
1772
1773
1773
1774
nth_bitmap_object_oid (bitmap_git , & oid , index_pos );
1774
1775
1775
- printf ("%s %" PRIu32 "\n " ,
1776
+ printf_ln ("%s %" PRIu32 "" ,
1776
1777
oid_to_hex (& oid ), get_be32 (bitmap_git -> hashes + index_pos ));
1777
1778
}
1778
1779
@@ -1934,7 +1935,7 @@ static off_t get_disk_usage_for_type(struct bitmap_index *bitmap_git,
1934
1935
struct object_id oid ;
1935
1936
nth_midxed_object_oid (& oid , bitmap_git -> midx , midx_pos );
1936
1937
1937
- die (_ ("could not find %s in pack %s at offset %" PRIuMAX ),
1938
+ die (_ ("could not find '%s' in pack '%s' at offset %" PRIuMAX ),
1938
1939
oid_to_hex (& oid ),
1939
1940
pack -> pack_name ,
1940
1941
(uintmax_t )offset );
@@ -1970,7 +1971,7 @@ static off_t get_disk_usage_for_extended(struct bitmap_index *bitmap_git)
1970
1971
continue ;
1971
1972
1972
1973
if (oid_object_info_extended (the_repository , & obj -> oid , & oi , 0 ) < 0 )
1973
- die (_ ("unable to get disk usage of %s " ),
1974
+ die (_ ("unable to get disk usage of '%s' " ),
1974
1975
oid_to_hex (& obj -> oid ));
1975
1976
1976
1977
total += object_size ;
0 commit comments