]> git.ipfire.org Git - thirdparty/git.git/commitdiff
replay: small set of cleanups
authorPatrick Steinhardt <ps@pks.im>
Tue, 13 Jan 2026 09:54:34 +0000 (10:54 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jan 2026 13:41:16 +0000 (05:41 -0800)
Perform a small set of cleanups so that the "replay" logic compiles with
"-Wsign-compare" and doesn't use `the_repository` anymore. Note that
there are still some implicit dependencies on `the_repository`, e.g.
because we use `get_commit_output_encoding()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
replay.c

index c580a9caa2a43eac925f680d68a16e66a76a4174..ae13b59abced70de33a5859384d9876a2825ade7 100644 (file)
--- a/replay.c
+++ b/replay.c
@@ -1,5 +1,4 @@
 #define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
 #include "environment.h"
@@ -78,7 +77,7 @@ static struct commit *create_commit(struct repository *repo,
        obj = parse_object(repo, &ret);
 
 out:
-       repo_unuse_commit_buffer(the_repository, based_on, message);
+       repo_unuse_commit_buffer(repo, based_on, message);
        free_commit_extra_headers(extra);
        free_commit_list(parents);
        strbuf_release(&msg);
@@ -90,16 +89,14 @@ struct ref_info {
        struct commit *onto;
        struct strset positive_refs;
        struct strset negative_refs;
-       int positive_refexprs;
-       int negative_refexprs;
+       size_t positive_refexprs;
+       size_t negative_refexprs;
 };
 
 static void get_ref_information(struct repository *repo,
                                struct rev_cmdline_info *cmd_info,
                                struct ref_info *ref_info)
 {
-       int i;
-
        ref_info->onto = NULL;
        strset_init(&ref_info->positive_refs);
        strset_init(&ref_info->negative_refs);
@@ -121,7 +118,7 @@ static void get_ref_information(struct repository *repo,
         * the second because they'd likely just be replaying commits on top
         * of the same commit and not making any difference.
         */
-       for (i = 0; i < cmd_info->nr; i++) {
+       for (size_t i = 0; i < cmd_info->nr; i++) {
                struct rev_cmdline_entry *e = cmd_info->rev + i;
                struct object_id oid;
                const char *refexpr = e->name;