mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
rebase -i: use struct commit when parsing options
This is in preparation for using `struct rebase_options` when parsing options in cmd_rebase__interactive(). Using a string for onto, restrict_revision and upstream, was a hangover from the scripted version of rebase. The functions that use these variables are updated to take a `struct commit`. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c44c24621d
commit
7d3488eb89
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user