55 */
66
77#define USE_THE_REPOSITORY_VARIABLE
8- #define DISABLE_SIGN_COMPARE_WARNINGS
98
109#include "builtin.h"
1110#include "advice.h"
@@ -40,14 +39,12 @@ static struct {
4039 } * entry ;
4140} list ;
4241
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 )
4443{
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 ++ ;
5148 }
5249 return -1 ;
5350}
@@ -58,7 +55,7 @@ static void print_error_files(struct string_list *files_list,
5855 int * errs )
5956{
6057 if (files_list -> nr ) {
61- int i ;
58+ unsigned int i ;
6259 struct strbuf err_msg = STRBUF_INIT ;
6360
6461 strbuf_addstr (& err_msg , main_msg );
@@ -83,7 +80,7 @@ static void submodules_absorb_gitdir_if_needed(void)
8380
8481 pos = index_name_pos (the_repository -> index , name , strlen (name ));
8582 if (pos < 0 ) {
86- pos = get_ours_cache_pos (name , pos );
83+ pos = get_ours_cache_pos (name , - pos - 1 );
8784 if (pos < 0 )
8885 continue ;
8986 }
@@ -131,7 +128,7 @@ static int check_local_mod(struct object_id *head, int index_only)
131128 * Skip unmerged entries except for populated submodules
132129 * that could lose history when removed.
133130 */
134- pos = get_ours_cache_pos (name , pos );
131+ pos = get_ours_cache_pos (name , - pos - 1 );
135132 if (pos < 0 )
136133 continue ;
137134
@@ -314,7 +311,7 @@ int cmd_rm(int argc,
314311 if (pathspec_needs_expanded_index (the_repository -> index , & pathspec ))
315312 ensure_full_index (the_repository -> index );
316313
317- for (i = 0 ; i < the_repository -> index -> cache_nr ; i ++ ) {
314+ for (unsigned int i = 0 ; i < the_repository -> index -> cache_nr ; i ++ ) {
318315 const struct cache_entry * ce = the_repository -> index -> cache [i ];
319316
320317 if (!include_sparse &&
0 commit comments