summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2019-04-17 14:30:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-19 08:32:10 (GMT)
commit338985317eb84007f0d08979e751cbf32a375a52 (patch)
tree4ad42aaa93400eafcac99c8cb7ee98932b300fb1 /parse-options-cb.c
parent7d3488eb893ba53186770181171ee8ebc8100e18 (diff)
downloadgit-338985317eb84007f0d08979e751cbf32a375a52.zip
git-338985317eb84007f0d08979e751cbf32a375a52.tar.gz
git-338985317eb84007f0d08979e751cbf32a375a52.tar.bz2
rebase -i: use struct object_id for squash_onto
More preparation for using `struct rebase_options` in cmd_rebase__interactive(). Using a string was a hangover from the scripted version of rebase, update the functions that use `squash_onto` to take a `sturct object_id`. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 2206eb7..28ad5cd 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;