static int bisect_next_check(const struct bisect_terms *terms, const char *current_term) { int missing_good = 1, missing_bad = 1, retval = 0; const char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad); const char *good_glob = xstrfmt("%s-*", terms->term_good); if (ref_exists(bad_ref)) missing_bad = 0; for_each_glob_ref_in(mark_good, good_glob, "refs/bisect/", (void *) &missing_good); if (!missing_good && !missing_bad) goto finish; if (!current_term) { retval = -1; goto finish; } if (missing_good && !missing_bad && !strcmp(current_term, terms->term_good)) { char *yesno; /* * have bad (or new) but not good (or old). We could bisect * although this is less optimum. */ warning(_("bisecting only with a %s commit"), terms->term_bad); if (!isatty(0)) goto finish; /* * TRANSLATORS: Make sure to include [Y] and [n] in your * translation. The program will only accept English input * at this point. */ yesno = git_prompt(_("Are you sure [Y/n]? "), PROMPT_ECHO); if (starts_with(yesno, "N") || starts_with(yesno, "n")) retval = -1; goto finish; } if (!is_empty_or_missing_file(git_path_bisect_start())) { retval = error(_(need_bad_and_good_revision_warning), vocab_bad, vocab_good, vocab_bad, vocab_good); } else { retval = error(_(need_bisect_start_warning), vocab_good, vocab_bad, vocab_good, vocab_bad); } finish: free((void *) good_glob); free((void *) bad_ref); return retval; }
static char *credential_ask_one(const char *what, struct credential *c, int flags) { struct strbuf desc = STRBUF_INIT; struct strbuf prompt = STRBUF_INIT; char *r; credential_describe(c, &desc); if (desc.len) strbuf_addf(&prompt, "%s for '%s': ", what, desc.buf); else strbuf_addf(&prompt, "%s: ", what); r = git_prompt(prompt.buf, flags); strbuf_release(&desc); strbuf_release(&prompt); return xstrdup(r); }