]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'cc/bisect-start-fix'
authorJunio C Hamano <gitster@pobox.com>
Sun, 4 Oct 2020 19:49:08 +0000 (12:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 4 Oct 2020 19:49:08 +0000 (12:49 -0700)
"git bisect start X Y", when X and Y are not valid committish
object names, should take X and Y as pathspec, but didn't.

* cc/bisect-start-fix:
  bisect: don't use invalid oid as rev when starting

1  2 
builtin/bisect--helper.c
t/t6030-bisect-porcelain.sh

index 7dcc1b518831fed008f0f06463554099d60cff68,2fcc023a3b828f0f9e1102b19b900d6ae03d7f70..2f8ef0ea307d920efda0374e6b4a94c72fa2bd38
@@@ -482,16 -471,16 +482,15 @@@ static int bisect_start(struct bisect_t
                        must_write_terms = 1;
                        free((void *) terms->term_bad);
                        terms->term_bad = xstrdup(arg);
 -              } else if (starts_with(arg, "--") &&
 -                       !one_of(arg, "--term-good", "--term-bad", NULL)) {
 +              } 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;
Simple merge