diff options
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r-- | parse-options-cb.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c index 2206eb763cf..28ad5cd94b9 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -129,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; |