Elijah Newren [off-list ref] writes:
quoted
quoted
+static long parse_empty_value(const char *value)
+{
+ if (!value)
+ return EMPTY_UNSPECIFIED;
+ else if (!strcasecmp(value, "drop"))
+ return EMPTY_DROP;
+ else if (!strcasecmp(value, "keep"))
+ return EMPTY_KEEP;
+ else if (!strcasecmp(value, "ask"))
+ return EMPTY_ASK;
Not an error but just silently ignored?
Oops, I'll switch it to an error.
Not necessarily (see "Ahh, OK" below).
quoted
quoted
+ return EMPTY_UNSPECIFIED;
+}
+
quoted
+static int parse_opt_empty(const struct option *opt, const char *arg, int unset)
+{
+ struct rebase_options *options = opt->value;
+ long value = parse_empty_value(arg);
Ahh, OK.
Wouldn't it be better to make the variable and the parsing helper
function of type "enum empty_type", not "long", just like the field
in the rebase_options struct?
Indeed, I'll fix this up.
Thanks. I was wondering if there is something subtle I didn't see
going on around here.