]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/bisect--helper.c
Merge branch 'mr/bisect-in-c-2'
[thirdparty/git.git] / builtin / bisect--helper.c
index 64f16d5d92ffb0c1433e92735b3e3b5516f9b124..7512b880f0d67fbe5dba8de93271324b8338d7d9 100644 (file)
@@ -28,7 +28,7 @@ static const char * const git_bisect_helper_usage[] = {
        N_("git bisect--helper --bisect-check-and-set-terms <command> <good_term> <bad_term>"),
        N_("git bisect--helper --bisect-next-check <good_term> <bad_term> [<term>]"),
        N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"),
-       N_("git bisect--helper --bisect-start [--term-{old,good}=<term> --term-{new,bad}=<term>]"
+       N_("git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}=<term>]"
                                            " [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]"),
        N_("git bisect--helper --bisect-next"),
        N_("git bisect--helper --bisect-auto-next"),
@@ -672,14 +672,13 @@ static int bisect_start(struct bisect_terms *terms, const char **argv, int argc)
                        terms->term_bad = xstrdup(arg);
                } else if (starts_with(arg, "--")) {
                        return error(_("unrecognized option: '%s'"), arg);
-               } else {
-                       char *commit_id = xstrfmt("%s^{commit}", arg);
-                       if (get_oid(commit_id, &oid) && has_double_dash)
-                               die(_("'%s' does not appear to be a valid "
-                                     "revision"), arg);
-
+               } else if (!get_oidf(&oid, "%s^{commit}", arg)) {
                        string_list_append(&revs, oid_to_hex(&oid));
-                       free(commit_id);
+               } else if (has_double_dash) {
+                       die(_("'%s' does not appear to be a valid "
+                             "revision"), arg);
+               } else {
+                       break;
                }
        }
        pathspec_pos = i;