Merge branch 'pw/rebase-i-internal'

The internal implementation of "git rebase -i" has been updated to
avoid forking a separate "rebase--interactive" process.

* pw/rebase-i-internal:
  rebase -i: run without forking rebase--interactive
  rebase: use a common action enum
  rebase -i: use struct rebase_options in do_interactive_rebase()
  rebase -i: use struct rebase_options to parse args
  rebase -i: use struct object_id for squash_onto
  rebase -i: use struct commit when parsing options
  rebase -i: remove duplication
  rebase -i: combine rebase--interactive.c with rebase.c
  rebase: use OPT_RERERE_AUTOUPDATE()
  rebase: rename write_basic_state()
  rebase: don't translate trace strings
  sequencer: always discard index after checkout
This commit is contained in:
Junio C Hamano
2019-05-13 23:50:34 +09:00
7 changed files with 532 additions and 511 deletions

View File

@ -96,6 +96,23 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)
return 0;
}
int parse_opt_commit(const struct option *opt, const char *arg, int unset)
{
struct object_id oid;
struct commit *commit;
struct commit **target = opt->value;
if (!arg)
return -1;
if (get_oid(arg, &oid))
return error("malformed object name %s", arg);
commit = lookup_commit_reference(the_repository, &oid);
if (!commit)
return error("no such commit %s", arg);
*target = commit;
return 0;
}
int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
{
struct object_id oid;
@ -112,6 +129,23 @@ int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
return 0;
}
int parse_opt_object_id(const struct option *opt, const char *arg, int unset)
{
struct object_id oid;
struct object_id *target = opt->value;
if (unset) {
*target = null_oid;
return 0;
}
if (!arg)
return -1;
if (get_oid(arg, &oid))
return error(_("malformed object name '%s'"), arg);
*target = oid;
return 0;
}
int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
{
int *target = opt->value;