summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorLibravatar Jiang Xin <worldhello.net@gmail.com>2021-10-30 09:34:30 +0800
committerLibravatar Jiang Xin <worldhello.net@gmail.com>2021-10-30 09:34:30 +0800
commitcd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0 (patch)
treeba34cf45622ddcd8e9d250a048661a7e6a8a35ee /bisect.c
parentMerge branch 'master' of github.com:nafmo/git-l10n-sv (diff)
parentGit 2.34-rc0 (diff)
downloadtgif-cd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0.tar.xz
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (762 commits) Git 2.34-rc0 wrapper: remove xunsetenv() log: document --encoding behavior on iconv() failure Revert "logmsg_reencode(): warn when iconv() fails" completion: fix incorrect bash/zsh string equality check add, rm, mv: fix bug that prevents the update of non-sparse dirs git-bundle.txt: add missing words and punctuation Documentation/Makefile: fix lint-docs mkdir dependency submodule: drop unused sm_name parameter from append_fetch_remotes() The fifteenth batch gitweb.txt: change "folder" to "directory" gitignore.txt: change "folder" to "directory" git-multi-pack-index.txt: change "folder" to "directory" git.txt: fix typo archive: describe compression level option config.txt: fix typo command-list.txt: remove 'sparse-index' from main help userdiff-cpp: back out the digit-separators in numbers submodule--helper: fix incorrect newlines in an error message branch (doc): -m/-c copies config and reflog ...
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/bisect.c b/bisect.c
index af2863d044..888949fba6 100644
--- a/bisect.c
+++ b/bisect.c
@@ -23,7 +23,6 @@ static struct oid_array skipped_revs;
static struct object_id *current_bad_oid;
static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
-static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
static const char *term_bad;
static const char *term_good;
@@ -728,7 +727,9 @@ static int is_expected_rev(const struct object_id *oid)
static enum bisect_error bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
{
char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
- enum bisect_error res = BISECT_OK;
+ struct commit *commit;
+ struct pretty_print_context pp = {0};
+ struct strbuf commit_msg = STRBUF_INIT;
oid_to_hex_r(bisect_rev_hex, bisect_rev);
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
@@ -738,24 +739,21 @@ static enum bisect_error bisect_checkout(const struct object_id *bisect_rev, int
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
} else {
- res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
- if (res)
+ if (run_command_v_opt(argv_checkout, RUN_GIT_CMD))
/*
* Errors in `run_command()` itself, signaled by res < 0,
* and errors in the child process, signaled by res > 0
- * can both be treated as regular BISECT_FAILURE (-1).
+ * can both be treated as regular BISECT_FAILED (-1).
*/
- return -abs(res);
+ return BISECT_FAILED;
}
- argv_show_branch[1] = bisect_rev_hex;
- res = run_command_v_opt(argv_show_branch, RUN_GIT_CMD);
- /*
- * Errors in `run_command()` itself, signaled by res < 0,
- * and errors in the child process, signaled by res > 0
- * can both be treated as regular BISECT_FAILURE (-1).
- */
- return -abs(res);
+ commit = lookup_commit_reference(the_repository, bisect_rev);
+ format_commit_message(commit, "[%H] %s%n", &commit_msg, &pp);
+ fputs(commit_msg.buf, stdout);
+ strbuf_release(&commit_msg);
+
+ return BISECT_OK;
}
static struct commit *get_commit_reference(struct repository *r,