]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: enable sign compare warnings check
authorshejialuo <shejialuo@gmail.com>
Wed, 17 Sep 2025 09:20:10 +0000 (17:20 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Sep 2025 14:55:32 +0000 (07:55 -0700)
After fixing the tricky compare warning introduced by calling
"string_list_find_insert_index", there are only two loop iterator type
mismatches. Fix them to enable compare warnings check.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c

diff --git a/refs.c b/refs.c
index a8f06b9a0ad1515f9575fed74bf452bc9183d115..79069c37b88df10b677e58b625524e388f2ce218 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -3,7 +3,6 @@
  */
 
 #define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
 #include "advice.h"
@@ -2381,7 +2380,7 @@ static int run_transaction_hook(struct ref_transaction *transaction,
        struct child_process proc = CHILD_PROCESS_INIT;
        struct strbuf buf = STRBUF_INIT;
        const char *hook;
-       int ret = 0, i;
+       int ret = 0;
 
        hook = find_hook(transaction->ref_store->repo, "reference-transaction");
        if (!hook)
@@ -2398,7 +2397,7 @@ static int run_transaction_hook(struct ref_transaction *transaction,
 
        sigchain_push(SIGPIPE, SIG_IGN);
 
-       for (i = 0; i < transaction->nr; i++) {
+       for (size_t i = 0; i < transaction->nr; i++) {
                struct ref_update *update = transaction->updates[i];
 
                if (update->flags & REF_LOG_ONLY)
@@ -2791,9 +2790,7 @@ void ref_transaction_for_each_queued_update(struct ref_transaction *transaction,
                                            ref_transaction_for_each_queued_update_fn cb,
                                            void *cb_data)
 {
-       int i;
-
-       for (i = 0; i < transaction->nr; i++) {
+       for (size_t i = 0; i < transaction->nr; i++) {
                struct ref_update *update = transaction->updates[i];
 
                cb(update->refname,