diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-05-13 23:50:34 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-13 23:50:34 +0900 |
commit | 7ba06bc3d026cee54437db5cfddfffe7b4d7a187 (patch) | |
tree | eec56549e6d2e5593981ec2540b77f4a46e80309 /parse-options-cb.c | |
parent | 6cfa633565cc16f77d6e6d56fa608680828105a1 (diff) | |
parent | 460bc3ce7386582b3259f8e3a2c1ace443ddb1ae (diff) | |
download | git-7ba06bc3d026cee54437db5cfddfffe7b4d7a187.tar.gz |
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
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r-- | parse-options-cb.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c index 6e2e8d6273..4b95d04a37 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -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; |