]> git.ipfire.org Git - thirdparty/git.git/commitdiff
treewide: use setup_revisions_from_strvec() when we have a strvec
authorJeff King <peff@peff.net>
Fri, 19 Sep 2025 22:49:07 +0000 (18:49 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 21 Sep 2025 20:47:08 +0000 (13:47 -0700)
The previous commit introduced a wrapper to make using setup_revisions()
with a strvec easier and safer. It converted spots that were already
doing most of what the wrapper did.

Let's now convert spots where we were not setting up the
free_removed_argv_elements flag. As discussed in the previous commit,
this probably isn't fixing any bugs or leaks (since these sites wouldn't
trigger the re-shuffling of argv that causes them). This is mostly
future-proofing us against setup_revisions() becoming more aggressive
about its re-shuffling.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/describe.c
http-push.c
submodule.c

index d7dd8139dec4b698ebfa9d2841dbf56cb19d7d1c..c8b3081a4d06d94af04f551e6322d5df1762adf3 100644 (file)
@@ -525,7 +525,8 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
                     NULL);
 
        repo_init_revisions(the_repository, &revs, NULL);
-       if (setup_revisions(args.nr, args.v, &revs, NULL) > 1)
+       setup_revisions_from_strvec(&args, &revs, NULL);
+       if (args.nr > 1)
                BUG("setup_revisions could not handle all args?");
 
        if (prepare_revision_walk(&revs))
index 91a5465afb120e7f0864a7180f713b12d204b968..4c43ba3bc718831eca8323e15520a6154f7f0240 100644 (file)
@@ -1941,7 +1941,7 @@ int cmd_main(int argc, const char **argv)
                        strvec_pushf(&commit_argv, "^%s",
                                     oid_to_hex(&ref->old_oid));
                repo_init_revisions(the_repository, &revs, setup_git_directory());
-               setup_revisions(commit_argv.nr, commit_argv.v, &revs, NULL);
+               setup_revisions_from_strvec(&commit_argv, &revs, NULL);
                revs.edge_hint = 0; /* just in case */
 
                /* Generate a list of objects that need to be pushed */
index fff3c755703163da423d5978b8bdf0d36c6f8ea9..35c55155f7bf8379564d3664b34266e8debee681 100644 (file)
@@ -900,7 +900,7 @@ static void collect_changed_submodules(struct repository *r,
        save_warning = warn_on_object_refname_ambiguity;
        warn_on_object_refname_ambiguity = 0;
        repo_init_revisions(r, &rev, NULL);
-       setup_revisions(argv->nr, argv->v, &rev, &s_r_opt);
+       setup_revisions_from_strvec(argv, &rev, &s_r_opt);
        warn_on_object_refname_ambiguity = save_warning;
        if (prepare_revision_walk(&rev))
                die(_("revision walk setup failed"));