mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01: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
@@ -914,13 +914,12 @@ static void deepen(struct upload_pack_data *data, int depth)
|
||||
}
|
||||
|
||||
static void deepen_by_rev_list(struct upload_pack_data *data,
|
||||
int ac,
|
||||
const char **av)
|
||||
struct strvec *argv)
|
||||
{
|
||||
struct commit_list *result;
|
||||
|
||||
disable_commit_graph(the_repository);
|
||||
result = get_shallow_commits_by_rev_list(ac, av, SHALLOW, NOT_SHALLOW);
|
||||
result = get_shallow_commits_by_rev_list(argv, SHALLOW, NOT_SHALLOW);
|
||||
send_shallow(data, result);
|
||||
free_commit_list(result);
|
||||
send_unshallow(data);
|
||||
@@ -956,7 +955,7 @@ static int send_shallow_list(struct upload_pack_data *data)
|
||||
struct object *o = data->want_obj.objects[i].item;
|
||||
strvec_push(&av, oid_to_hex(&o->oid));
|
||||
}
|
||||
deepen_by_rev_list(data, av.nr, av.v);
|
||||
deepen_by_rev_list(data, &av);
|
||||
strvec_clear(&av);
|
||||
ret = 1;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user