mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
treewide: pass strvecs around for setup_revisions_from_strvec()
The previous commit converted callers of setup_revisions() with a strvec to use the safer and easier _from_strvec() variant. Let's now convert spots that don't directly have a strvec, but receive an argc/argv pair that eventually comes from one. We'll instead pass the strvec down to the point where we call setup_revisions(). That makes these functions slightly less flexible if they were to grow other callers that don't use strvecs, but this rigidity is buying us some safety. It is only safe to pass the free_removed_argv_elements option to setup_revisions() if we know the elements of argv/argc are allocated on the heap. That isn't communicated in the type system when we are passed the bare elements. But if we get a strvec, we know that the elements are allocated strings. And at any rate, each of these modified functions has only a single caller (that has a strvec), so the loss of flexibility is unlikely to ever matter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b553332f82
commit
18068139f2
@@ -213,7 +213,7 @@ static void show_commit(struct commit *commit, void *data)
|
||||
* are marked with shallow_flag. The list of border/shallow commits
|
||||
* are also returned.
|
||||
*/
|
||||
struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
||||
struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv,
|
||||
int shallow_flag,
|
||||
int not_shallow_flag)
|
||||
{
|
||||
@@ -232,7 +232,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
||||
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
save_commit_buffer = 0;
|
||||
setup_revisions(ac, av, &revs, NULL);
|
||||
setup_revisions_from_strvec(argv, &revs, NULL);
|
||||
|
||||
if (prepare_revision_walk(&revs))
|
||||
die("revision walk setup failed");
|
||||
|
||||
Reference in New Issue
Block a user