Merge branch 'ml/filter-branch-no-op-error' into next
[gitweb.git] / parse-options-cb.c
index c7320a73f48d48469ee2c4fd02096b6f96005c0b..c6679cb2cdee15981ee9ef31c402c358a3727d1e 100644 (file)
@@ -78,6 +78,22 @@ int parse_opt_verbosity_cb(const struct option *opt, const char *arg,
        return 0;
 }
 
+int parse_opt_commits(const struct option *opt, const char *arg, int unset)
+{
+       struct object_id oid;
+       struct commit *commit;
+
+       if (!arg)
+               return -1;
+       if (get_oid(arg, &oid))
+               return error("malformed object name %s", arg);
+       commit = lookup_commit_reference(&oid);
+       if (!commit)
+               return error("no such commit %s", arg);
+       commit_list_insert(commit, opt->value);
+       return 0;
+}
+
 int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
 {
        struct object_id oid;