Merge branch 'nd/switch-and-restore'
Two new commands "git switch" and "git restore" are introduced to split "checking out a branch to work on advancing its history" and "checking out paths out of the index and/or a tree-ish to work on advancing the current history" out of the single "git checkout" command. * nd/switch-and-restore: (46 commits) completion: disable dwim on "git switch -d" switch: allow to switch in the middle of bisect t2027: use test_must_be_empty Declare both git-switch and git-restore experimental help: move git-diff and git-reset to different groups doc: promote "git restore" user-manual.txt: prefer 'merge --abort' over 'reset --hard' completion: support restore t: add tests for restore restore: support --patch restore: replace --force with --ignore-unmerged restore: default to --source=HEAD when only --staged is specified restore: reject invalid combinations with --staged restore: add --worktree and --staged checkout: factor out worktree checkout code restore: disable overlay mode by default restore: make pathspec mandatory restore: take tree-ish from --source option instead checkout: split part of it to new command 'restore' doc: promote "git switch" ...
This commit is contained in:
@ -159,6 +159,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