On 12/01/2018 11:44 AM, Jeff King wrote:
repo_init_revisions(the_repository, &revs, NULL);
save_commit_buffer = 0;
- revs.allow_exclude_promisor_objects_opt = 1;
- setup_revisions(ac, av, &revs, NULL);
+
+ memset(&s_r_opt, 0, sizeof(s_r_opt));
+ s_r_opt.allow_exclude_promisor_objects = 1;
+ setup_revisions(ac, av, &revs, &s_r_opt);
I wonder if a static initializer for setup_revision_opt is worth it. It
would remove the need for this memset. Probably not a big deal either
way, though.
I think you mean something like this:
static struct setup_revision_opt s_r_opt = {NULL, NULL, NULL, 0, 1, 0};
This is a bit cryptic (I have to read the struct declaration in order to
know what is being set to 1) and if the struct ever gets a new field
before allow_exclude_promisor_objects, this initializer has to be updated.
static int handle_revision_opt(struct rev_info *revs, int argc, const char
**argv,
- int *unkc, const char **unkv)
+ int *unkc, const char **unkv,
+ int allow_exclude_promisor_objects)
Why not pass in the whole setup_revision_opt struct? We don't need
anything else from it yet, but it seems like the point of that struct is
to pass around preferences like this.
OK, the code reads better if I do that, so I agree.
-Peff