Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-10-04 22:49:08 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-04 22:49:08 +0300
commit03a01824a4ee07cd06b152bbff45066d6cf5542b (patch)
tree4a038a3a4036c0faa7f38a86d160540eff9adcb6 /builtin/bisect--helper.c
parent230ff3e9970755fe4ba2e69165eab1f61752f1d1 (diff)
parent73c6de06aff8d14b5e9f55f393d25f1213f3d43d (diff)
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
Diffstat (limited to 'builtin/bisect--helper.c')
-rw-r--r--builtin/bisect--helper.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 7dcc1b51883..2f8ef0ea307 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -484,14 +484,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;