verify_dotfile: mention case-insensitivity in comment
[gitweb.git] / parse-options-cb.c
index 16818830e97e099286f3aa259378de1b8e9fc322..7419780a9b644e74107eec31d1c75156374920b8 100644 (file)
@@ -96,17 +96,17 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)
 
 int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
 {
-       unsigned char sha1[20];
+       struct object_id oid;
 
        if (unset) {
-               sha1_array_clear(opt->value);
+               oid_array_clear(opt->value);
                return 0;
        }
        if (!arg)
                return -1;
-       if (get_sha1(arg, sha1))
+       if (get_oid(arg, &oid))
                return error(_("malformed object name '%s'"), arg);
-       sha1_array_append(opt->value, sha1);
+       oid_array_append(opt->value, &oid);
        return 0;
 }
 
@@ -158,6 +158,18 @@ int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
+/**
+ * Report that the option is unknown, so that other code can handle
+ * it. This can be used as a callback together with
+ * OPTION_LOWLEVEL_CALLBACK to allow an option to be documented in the
+ * "-h" output even if it's not being handled directly by
+ * parse_options().
+ */
+int parse_opt_unknown_cb(const struct option *opt, const char *arg, int unset)
+{
+       return -2;
+}
+
 /**
  * Recreates the command-line option in the strbuf.
  */