checkout: split options[] array in three pieces
This is a preparation step for introducing new commands that do parts of what checkout does. There will be two new commands, one is about switching branches, detaching HEAD... one about checking out paths. These share the a subset of command line options. The rest of command line options are separate. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
55cf704a9d
commit
2087182272
@ -122,6 +122,23 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct option *parse_options_dup(const struct option *o)
|
||||
{
|
||||
struct option *opts;
|
||||
int nr = 0;
|
||||
|
||||
while (o && o->type != OPTION_END) {
|
||||
nr++;
|
||||
o++;
|
||||
}
|
||||
|
||||
ALLOC_ARRAY(opts, nr + 1);
|
||||
memcpy(opts, o - nr, sizeof(*o) * nr);
|
||||
memset(opts + nr, 0, sizeof(*opts));
|
||||
opts[nr].type = OPTION_END;
|
||||
return opts;
|
||||
}
|
||||
|
||||
struct option *parse_options_concat(struct option *a, struct option *b)
|
||||
{
|
||||
struct option *ret;
|
||||
|
Reference in New Issue
Block a user