Skip to content

Commit b553332

Browse files
peffgitster
authored andcommitted
treewide: use setup_revisions_from_strvec() when we have a strvec
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>
1 parent f93c1d8 commit b553332

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

builtin/describe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
525525
NULL);
526526

527527
repo_init_revisions(the_repository, &revs, NULL);
528-
if (setup_revisions(args.nr, args.v, &revs, NULL) > 1)
528+
setup_revisions_from_strvec(&args, &revs, NULL);
529+
if (args.nr > 1)
529530
BUG("setup_revisions could not handle all args?");
530531

531532
if (prepare_revision_walk(&revs))

http-push.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ int cmd_main(int argc, const char **argv)
19411941
strvec_pushf(&commit_argv, "^%s",
19421942
oid_to_hex(&ref->old_oid));
19431943
repo_init_revisions(the_repository, &revs, setup_git_directory());
1944-
setup_revisions(commit_argv.nr, commit_argv.v, &revs, NULL);
1944+
setup_revisions_from_strvec(&commit_argv, &revs, NULL);
19451945
revs.edge_hint = 0; /* just in case */
19461946

19471947
/* Generate a list of objects that need to be pushed */

submodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static void collect_changed_submodules(struct repository *r,
900900
save_warning = warn_on_object_refname_ambiguity;
901901
warn_on_object_refname_ambiguity = 0;
902902
repo_init_revisions(r, &rev, NULL);
903-
setup_revisions(argv->nr, argv->v, &rev, &s_r_opt);
903+
setup_revisions_from_strvec(argv, &rev, &s_r_opt);
904904
warn_on_object_refname_ambiguity = save_warning;
905905
if (prepare_revision_walk(&rev))
906906
die(_("revision walk setup failed"));

0 commit comments

Comments
 (0)