Merge branch 'js/bisect-helper-check-get-oid-return-value'
[gitweb.git] / builtin / bisect--helper.c
index c1cff3266114323f466133b98050f5aec71c5f91..1fbe156e67a4c75694de7e606a21cf959dd19f51 100644 (file)
@@ -173,7 +173,7 @@ static int bisect_reset(const char *commit)
                        argv_array_clear(&argv);
                        return error(_("could not check out original"
                                       " HEAD '%s'. Try 'git bisect"
-                                      "reset <commit>'."), branch.buf);
+                                      " reset <commit>'."), branch.buf);
                }
                argv_array_clear(&argv);
        }
@@ -570,7 +570,10 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
        write_file(git_path_bisect_start(), "%s\n", start_head.buf);
 
        if (no_checkout) {
-               get_oid(start_head.buf, &oid);
+               if (get_oid(start_head.buf, &oid) < 0) {
+                       retval = error(_("invalid ref: '%s'"), start_head.buf);
+                       goto finish;
+               }
                if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0,
                               UPDATE_REFS_MSG_ON_ERR)) {
                        retval = -1;
@@ -646,7 +649,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "no-checkout", &no_checkout,
                         N_("update BISECT_HEAD instead of checking out the current commit")),
                OPT_BOOL(0, "no-log", &nolog,
-                        N_("no log for BISECT_WRITE ")),
+                        N_("no log for BISECT_WRITE")),
                OPT_END()
        };
        struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };