5
5
*/
6
6
7
7
#define USE_THE_REPOSITORY_VARIABLE
8
- #define DISABLE_SIGN_COMPARE_WARNINGS
9
8
10
9
#include "builtin.h"
11
10
#include "advice.h"
@@ -40,14 +39,12 @@ static struct {
40
39
} * entry ;
41
40
} list ;
42
41
43
- static int get_ours_cache_pos (const char * path , int pos )
42
+ static int get_ours_cache_pos (const char * path , unsigned int pos )
44
43
{
45
- int i = - pos - 1 ;
46
-
47
- while ((i < the_repository -> index -> cache_nr ) && !strcmp (the_repository -> index -> cache [i ]-> name , path )) {
48
- if (ce_stage (the_repository -> index -> cache [i ]) == 2 )
49
- return i ;
50
- i ++ ;
44
+ while ((pos < the_repository -> index -> cache_nr ) && !strcmp (the_repository -> index -> cache [pos ]-> name , path )) {
45
+ if (ce_stage (the_repository -> index -> cache [pos ]) == 2 )
46
+ return pos ;
47
+ pos ++ ;
51
48
}
52
49
return -1 ;
53
50
}
@@ -58,7 +55,7 @@ static void print_error_files(struct string_list *files_list,
58
55
int * errs )
59
56
{
60
57
if (files_list -> nr ) {
61
- int i ;
58
+ unsigned int i ;
62
59
struct strbuf err_msg = STRBUF_INIT ;
63
60
64
61
strbuf_addstr (& err_msg , main_msg );
@@ -83,7 +80,7 @@ static void submodules_absorb_gitdir_if_needed(void)
83
80
84
81
pos = index_name_pos (the_repository -> index , name , strlen (name ));
85
82
if (pos < 0 ) {
86
- pos = get_ours_cache_pos (name , pos );
83
+ pos = get_ours_cache_pos (name , - pos - 1 );
87
84
if (pos < 0 )
88
85
continue ;
89
86
}
@@ -131,7 +128,7 @@ static int check_local_mod(struct object_id *head, int index_only)
131
128
* Skip unmerged entries except for populated submodules
132
129
* that could lose history when removed.
133
130
*/
134
- pos = get_ours_cache_pos (name , pos );
131
+ pos = get_ours_cache_pos (name , - pos - 1 );
135
132
if (pos < 0 )
136
133
continue ;
137
134
@@ -314,7 +311,7 @@ int cmd_rm(int argc,
314
311
if (pathspec_needs_expanded_index (the_repository -> index , & pathspec ))
315
312
ensure_full_index (the_repository -> index );
316
313
317
- for (i = 0 ; i < the_repository -> index -> cache_nr ; i ++ ) {
314
+ for (unsigned int i = 0 ; i < the_repository -> index -> cache_nr ; i ++ ) {
318
315
const struct cache_entry * ce = the_repository -> index -> cache [i ];
319
316
320
317
if (!include_sparse &&
0 commit comments