1
1
#define USE_THE_REPOSITORY_VARIABLE
2
- #define DISABLE_SIGN_COMPARE_WARNINGS
3
2
4
3
#include "git-compat-util.h"
5
4
#include "hex.h"
@@ -134,7 +133,8 @@ static void free_depth_in_slab(int **ptr)
134
133
struct commit_list * get_shallow_commits (struct object_array * heads , int depth ,
135
134
int shallow_flag , int not_shallow_flag )
136
135
{
137
- int i = 0 , cur_depth = 0 ;
136
+ size_t i = 0 ;
137
+ int cur_depth = 0 ;
138
138
struct commit_list * result = NULL ;
139
139
struct object_array stack = OBJECT_ARRAY_INIT ;
140
140
struct commit * commit = NULL ;
@@ -335,16 +335,16 @@ static int write_shallow_commits_1(struct strbuf *out, int use_pack_protocol,
335
335
const struct oid_array * extra ,
336
336
unsigned flags )
337
337
{
338
- struct write_shallow_data data ;
339
- int i ;
340
- data . out = out ;
341
- data . use_pack_protocol = use_pack_protocol ;
342
- data . count = 0 ;
343
- data . flags = flags ;
338
+ struct write_shallow_data data = {
339
+ . out = out ,
340
+ . use_pack_protocol = use_pack_protocol ,
341
+ . flags = flags ,
342
+ } ;
343
+
344
344
for_each_commit_graft (write_one_shallow , & data );
345
345
if (!extra )
346
346
return data .count ;
347
- for (i = 0 ; i < extra -> nr ; i ++ ) {
347
+ for (size_t i = 0 ; i < extra -> nr ; i ++ ) {
348
348
strbuf_addstr (out , oid_to_hex (extra -> oid + i ));
349
349
strbuf_addch (out , '\n' );
350
350
data .count ++ ;
@@ -466,15 +466,14 @@ struct trace_key trace_shallow = TRACE_KEY_INIT(SHALLOW);
466
466
*/
467
467
void prepare_shallow_info (struct shallow_info * info , struct oid_array * sa )
468
468
{
469
- int i ;
470
469
trace_printf_key (& trace_shallow , "shallow: prepare_shallow_info\n" );
471
470
memset (info , 0 , sizeof (* info ));
472
471
info -> shallow = sa ;
473
472
if (!sa )
474
473
return ;
475
474
ALLOC_ARRAY (info -> ours , sa -> nr );
476
475
ALLOC_ARRAY (info -> theirs , sa -> nr );
477
- for (i = 0 ; i < sa -> nr ; i ++ ) {
476
+ for (size_t i = 0 ; i < sa -> nr ; i ++ ) {
478
477
if (repo_has_object_file (the_repository , sa -> oid + i )) {
479
478
struct commit_graft * graft ;
480
479
graft = lookup_commit_graft (the_repository ,
@@ -507,7 +506,7 @@ void clear_shallow_info(struct shallow_info *info)
507
506
void remove_nonexistent_theirs_shallow (struct shallow_info * info )
508
507
{
509
508
struct object_id * oid = info -> shallow -> oid ;
510
- int i , dst ;
509
+ size_t i , dst ;
511
510
trace_printf_key (& trace_shallow , "shallow: remove_nonexistent_theirs_shallow\n" );
512
511
for (i = dst = 0 ; i < info -> nr_theirs ; i ++ ) {
513
512
if (i != dst )
@@ -560,7 +559,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
560
559
{
561
560
unsigned int i , nr ;
562
561
struct commit_list * head = NULL ;
563
- int bitmap_nr = DIV_ROUND_UP (info -> nr_bits , 32 );
562
+ size_t bitmap_nr = DIV_ROUND_UP (info -> nr_bits , 32 );
564
563
size_t bitmap_size = st_mult (sizeof (uint32_t ), bitmap_nr );
565
564
struct commit * c = lookup_commit_reference_gently (the_repository , oid ,
566
565
1 );
@@ -660,7 +659,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
660
659
struct object_id * oid = info -> shallow -> oid ;
661
660
struct oid_array * ref = info -> ref ;
662
661
unsigned int i , nr ;
663
- int * shallow , nr_shallow = 0 ;
662
+ size_t * shallow , nr_shallow = 0 ;
664
663
struct paint_info pi ;
665
664
666
665
trace_printf_key (& trace_shallow , "shallow: assign_shallow_commits_to_refs\n" );
@@ -735,7 +734,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
735
734
736
735
struct commit_array {
737
736
struct commit * * commits ;
738
- int nr , alloc ;
737
+ size_t nr , alloc ;
739
738
};
740
739
741
740
static int add_ref (const char * refname UNUSED ,
@@ -753,12 +752,11 @@ static int add_ref(const char *refname UNUSED,
753
752
return 0 ;
754
753
}
755
754
756
- static void update_refstatus (int * ref_status , int nr , uint32_t * bitmap )
755
+ static void update_refstatus (int * ref_status , size_t nr , uint32_t * bitmap )
757
756
{
758
- unsigned int i ;
759
757
if (!ref_status )
760
758
return ;
761
- for (i = 0 ; i < nr ; i ++ )
759
+ for (size_t i = 0 ; i < nr ; i ++ )
762
760
if (bitmap [i / 32 ] & (1U << (i % 32 )))
763
761
ref_status [i ]++ ;
764
762
}
@@ -773,8 +771,8 @@ static void post_assign_shallow(struct shallow_info *info,
773
771
struct object_id * oid = info -> shallow -> oid ;
774
772
struct commit * c ;
775
773
uint32_t * * bitmap ;
776
- int dst , i , j ;
777
- int bitmap_nr = DIV_ROUND_UP (info -> ref -> nr , 32 );
774
+ size_t dst , i , j ;
775
+ size_t bitmap_nr = DIV_ROUND_UP (info -> ref -> nr , 32 );
778
776
struct commit_array ca ;
779
777
780
778
trace_printf_key (& trace_shallow , "shallow: post_assign_shallow\n" );
0 commit comments