mirror of
https://github.com/git/git.git
synced 2026-01-11 02:32:58 +00:00
Merge branch 'ab/rm-sign-compare'
Some warnings from "-Wsign-compare" for builtin/rm.c have been squelched. * ab/rm-sign-compare: rm: fix sign comparison warnings
This commit is contained in:
21
builtin/rm.c
21
builtin/rm.c
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "advice.h"
|
||||
@@ -40,14 +39,12 @@ static struct {
|
||||
} *entry;
|
||||
} list;
|
||||
|
||||
static int get_ours_cache_pos(const char *path, int pos)
|
||||
static int get_ours_cache_pos(const char *path, unsigned int pos)
|
||||
{
|
||||
int i = -pos - 1;
|
||||
|
||||
while ((i < the_repository->index->cache_nr) && !strcmp(the_repository->index->cache[i]->name, path)) {
|
||||
if (ce_stage(the_repository->index->cache[i]) == 2)
|
||||
return i;
|
||||
i++;
|
||||
while ((pos < the_repository->index->cache_nr) && !strcmp(the_repository->index->cache[pos]->name, path)) {
|
||||
if (ce_stage(the_repository->index->cache[pos]) == 2)
|
||||
return pos;
|
||||
pos++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -58,7 +55,7 @@ static void print_error_files(struct string_list *files_list,
|
||||
int *errs)
|
||||
{
|
||||
if (files_list->nr) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct strbuf err_msg = STRBUF_INIT;
|
||||
|
||||
strbuf_addstr(&err_msg, main_msg);
|
||||
@@ -83,7 +80,7 @@ static void submodules_absorb_gitdir_if_needed(void)
|
||||
|
||||
pos = index_name_pos(the_repository->index, name, strlen(name));
|
||||
if (pos < 0) {
|
||||
pos = get_ours_cache_pos(name, pos);
|
||||
pos = get_ours_cache_pos(name, -pos - 1);
|
||||
if (pos < 0)
|
||||
continue;
|
||||
}
|
||||
@@ -131,7 +128,7 @@ static int check_local_mod(struct object_id *head, int index_only)
|
||||
* Skip unmerged entries except for populated submodules
|
||||
* that could lose history when removed.
|
||||
*/
|
||||
pos = get_ours_cache_pos(name, pos);
|
||||
pos = get_ours_cache_pos(name, -pos - 1);
|
||||
if (pos < 0)
|
||||
continue;
|
||||
|
||||
@@ -314,7 +311,7 @@ int cmd_rm(int argc,
|
||||
if (pathspec_needs_expanded_index(the_repository->index, &pathspec))
|
||||
ensure_full_index(the_repository->index);
|
||||
|
||||
for (i = 0; i < the_repository->index->cache_nr; i++) {
|
||||
for (unsigned int i = 0; i < the_repository->index->cache_nr; i++) {
|
||||
const struct cache_entry *ce = the_repository->index->cache[i];
|
||||
|
||||
if (!include_sparse &&
|
||||
|
||||
Reference in New Issue
Block a user