Skip to content

Commit cd1cae2

Browse files
committed
Fix -Wsign-compare warnings in builtin/bisect.c by ensuring type consistency
1 parent cb0ae67 commit cd1cae2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: builtin/bisect.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define USE_THE_REPOSITORY_VARIABLE
2-
#define DISABLE_SIGN_COMPARE_WARNINGS
2+
33

44
#include "builtin.h"
55
#include "copy.h"
@@ -694,9 +694,10 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char
694694
static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
695695
const char **argv)
696696
{
697+
int i;
697698
int no_checkout = 0;
698699
int first_parent_only = 0;
699-
int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
700+
int has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
700701
int flags, pathspec_pos;
701702
enum bisect_error res = BISECT_OK;
702703
struct string_list revs = STRING_LIST_INIT_DUP;
@@ -775,7 +776,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
775776
*/
776777
if (revs.nr)
777778
must_write_terms = 1;
778-
for (i = 0; i < revs.nr; i++) {
779+
for (i = 0; i < (int)revs.nr; i++) {
779780
if (bad_seen) {
780781
string_list_append(&states, terms->term_good);
781782
} else {
@@ -858,7 +859,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
858859
sq_quote_argv(&bisect_names, argv + pathspec_pos);
859860
write_file(git_path_bisect_names(), "%s\n", bisect_names.buf);
860861

861-
for (i = 0; i < states.nr; i++)
862+
for (i = 0; i < (int)states.nr; i++)
862863
if (bisect_write(states.items[i].string,
863864
revs.items[i].string, terms, 1)) {
864865
res = BISECT_FAILED;
@@ -924,8 +925,9 @@ static int bisect_autostart(struct bisect_terms *terms)
924925
static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
925926
const char **argv)
926927
{
928+
int i;
927929
const char *state;
928-
int i, verify_expected = 1;
930+
int verify_expected = 1;
929931
struct object_id oid, expected;
930932
struct oid_array revs = OID_ARRAY_INIT;
931933

@@ -984,7 +986,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
984986
if (refs_read_ref(get_main_ref_store(the_repository), "BISECT_EXPECTED_REV", &expected))
985987
verify_expected = 0; /* Ignore invalid file contents */
986988

987-
for (i = 0; i < revs.nr; i++) {
989+
for (i = 0; i < (int)revs.nr; i++) {
988990
if (bisect_write(state, oid_to_hex(&revs.oid[i]), terms, 0)) {
989991
oid_array_clear(&revs);
990992
return BISECT_FAILED;

0 commit comments

Comments
 (0)