From: Junio C Hamano Date: Sun, 4 Oct 2020 19:49:08 +0000 (-0700) Subject: Merge branch 'cc/bisect-start-fix' X-Git-Tag: v2.29.0-rc0~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03a01824a4ee07cd06b152bbff45066d6cf5542b;p=thirdparty%2Fgit.git Merge branch 'cc/bisect-start-fix' "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 --- 03a01824a4ee07cd06b152bbff45066d6cf5542b diff --cc builtin/bisect--helper.c index 7dcc1b5188,2fcc023a3b..2f8ef0ea30 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@@ -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;