The js/bisect-in-c topic got replaced by dd/bisect-helper-subcommand and later dd/git-bisect-builtin to fix a regression in "bisect".
This small set of fixes is a cherry-pick of various miscellanious fixes that were part of js/bisect-in-c that are still worth having. Johannes and I have coordinated my submission of this follow-up topic off-list.
The only "new" commit here is the 2/6. It's a cherry-pick of Johannes's commit to do the same, but as the change to the base was so extensive (the range diff won't even pick it up anymore with the default --creation-factor) he suggested I change the authorship, which I've done here.
There's still other stuff worth picking up from js/bisect-in-c. In particular we should be using parse_options() for the various sub-commands of "bisect". But as those changes had much more extensive conflicts let's leave them for later.
The range-diff here is to pr-1132/dscho/bisect-in-c-v6[1]. My own branch & CI for this is at [2].
1. https://lore.kernel.org/git/pull.1132.v6.git.1661885419.gitgitgadget@gmail.com/ 2. https://github.com/avar/git/tree/avar-js/bisect-in-c-rebased
Johannes Schindelin (5): bisect--helper: simplify exit code computation bisect: verify that a bogus option won't try to start a bisection bisect run: fix the error message bisect: remove Cogito-related code bisect: no longer try to clean up left-over `.git/head-name` files
Ævar Arnfjörð Bjarmason (1): bisect--helper: make the order consistently `argc, argv`
bisect.c | 3 --- builtin/bisect.c | 52 ++++++++++++++----------------------- t/t6030-bisect-porcelain.sh | 21 ++++++++++++++- 3 files changed, 40 insertions(+), 36 deletions(-)
Range-diff:
1: 05262b6a7d1 < -: ----------- bisect--helper: retire the --no-log option
2: 1e43148864a < -: ----------- bisect--helper: really retire --bisect-next-check
3: 1a1649d9d0d < -: ----------- bisect--helper: really retire `--bisect-autostart`
4: 9ab30552c6a ! 1: c8c648e4b8c bisect--helper: simplify exit code computation
@@ Commit message
Let's use it instead of duplicating the logic.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- ## builtin/bisect--helper.c ##
-@@ builtin/bisect--helper.c: int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
+ ## builtin/bisect.c ##
+@@ builtin/bisect.c: int cmd_bisect(int argc, const char **argv, const char *prefix)
+ res = fn(argc, argv, prefix);
}
- free_terms(&terms);
- /*
- * Handle early success
5: 92b3b116ef8 < -: ----------- bisect--helper: make `terms` an explicit singleton
6: c9dc0281e38 < -: ----------- bisect--helper: make the order consistently `argc, argv`
7: e97e187bbec < -: ----------- bisect--helper: migrate to OPT_SUBCOMMAND()
-: ----------- > 2: a0de7ad6836 bisect--helper: make the order consistently `argc, argv`
8: 30c87f2e92e ! 3: e1e31278fef bisect: verify that a bogus option won't try to start a bisection
@@ Commit message
by "git bisect start"` and fail if it was found.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
## t/t6030-bisect-porcelain.sh ##
@@ t/t6030-bisect-porcelain.sh: test_expect_success 'bisect start with one term1 and term2' '
9: 4696652b99c ! 4: 59a8a3085b1 bisect run: fix the error message
@@ Commit message
Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- ## builtin/bisect--helper.c ##
-@@ builtin/bisect--helper.c: static int cmd_bisect_run(int argc, const char **argv, const char *prefix)
- printf(_("bisect found first bad commit"));
+ ## builtin/bisect.c ##
+@@ builtin/bisect.c: static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
+ puts(_("bisect found first bad commit"));
res = BISECT_OK;
} else if (res) {
-- error(_("bisect run failed: 'git bisect--helper --bisect-state"
-+ error(_("bisect run failed: 'git bisect"
- " %s' exited with error code %d"), new_state, res);
+- error(_("bisect run failed: 'bisect-state %s'"
++ error(_("bisect run failed: 'git bisect %s'"
+ " exited with error code %d"), new_state, res);
} else {
continue;
10: b202a0e386c < -: ----------- bisect: avoid double-quoting when printing the failed command
11: 3376b450867 < -: ----------- bisect--helper: calling `bisect_state()` without an argument is a bug
12: e7623508f90 < -: ----------- bisect--helper: make `state` optional
13: 3f052580c95 < -: ----------- bisect: move even the command-line parsing to `bisect--helper`
14: a83fe3dc3c2 < -: ----------- Turn `git bisect` into a full built-in
15: f2132b61ff7 ! 5: 1b70cd79cae bisect: remove Cogito-related code
@@ Commit message
remove the last remnant of Cogito-accommodating code.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
## builtin/bisect.c ##
@@ builtin/bisect.c: static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
@@ builtin/bisect.c: static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXP
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
-@@ builtin/bisect.c: static int cmd_bisect_start(int argc, const char **argv, const char *prefix)
+@@ builtin/bisect.c: static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
strbuf_addstr(&start_head, oid_to_hex(&head_oid));
} else if (!get_oid(head, &head_oid) &&
skip_prefix(head, "refs/heads/", &head)) {
16: 4f93692e071 ! 6: 2ad89aca728 bisect: no longer try to clean up left-over `.git/head-name` files
@@ Commit message
So let's remove that code, at long last.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
## bisect.c ##
@@ bisect.c: static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")-- 2.39.0.rc2.1048.g0e5493b8d5b