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

git.kernel.org/pub/scm/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-08-18 03:02:45 +0300
committerJunio C Hamano <gitster@pobox.com>2020-08-18 03:02:45 +0300
commit47f0f94bc796037c43000a9852cdf9209a3c3274 (patch)
tree7636f85361a0ced48efa126f27e1247596afb089 /builtin/bisect--helper.c
parent789279e7f8439ea0e0727f6de36b2edafcbc5f3c (diff)
parentad464a4e84b502fdfd4671f1c443060c7e87113f (diff)
Merge branch 'al/bisect-first-parent'
"git bisect" learns the "--first-parent" option to find the first breakage along the first-parent chain. * al/bisect-first-parent: bisect: combine args passed to find_bisection() bisect: introduce first-parent flag cmd_bisect__helper: defer parsing no-checkout flag rev-list: allow bisect and first-parent flags t6030: modernize "git bisect run" tests
Diffstat (limited to 'builtin/bisect--helper.c')
-rw-r--r--builtin/bisect--helper.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index d19300687f..cdda279b23 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -16,9 +16,10 @@ static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
static GIT_PATH_FUNC(git_path_head_name, "head-name")
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
+static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
static const char * const git_bisect_helper_usage[] = {
- N_("git bisect--helper --next-all [--no-checkout]"),
+ N_("git bisect--helper --next-all"),
N_("git bisect--helper --write-terms <bad_term> <good_term>"),
N_("git bisect--helper --bisect-clean-state"),
N_("git bisect--helper --bisect-reset [<commit>]"),
@@ -27,7 +28,7 @@ static const char * const git_bisect_helper_usage[] = {
N_("git bisect--helper --bisect-next-check <good_term> <bad_term> [<term>]"),
N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"),
N_("git bisect--helper --bisect-start [--term-{old,good}=<term> --term-{new,bad}=<term>]"
- "[--no-checkout] [<bad> [<good>...]] [--] [<paths>...]"),
+ " [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]"),
NULL
};
@@ -420,9 +421,10 @@ finish:
return res;
}
-static int bisect_start(struct bisect_terms *terms, int no_checkout,
- const char **argv, int argc)
+static int bisect_start(struct bisect_terms *terms, const char **argv, int argc)
{
+ int no_checkout = 0;
+ int first_parent_only = 0;
int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
int flags, pathspec_pos, res = 0;
struct string_list revs = STRING_LIST_INIT_DUP;
@@ -452,6 +454,8 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
break;
} else if (!strcmp(arg, "--no-checkout")) {
no_checkout = 1;
+ } else if (!strcmp(arg, "--first-parent")) {
+ first_parent_only = 1;
} else if (!strcmp(arg, "--term-good") ||
!strcmp(arg, "--term-old")) {
i++;
@@ -576,6 +580,9 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
*/
write_file(git_path_bisect_start(), "%s\n", start_head.buf);
+ if (first_parent_only)
+ write_file(git_path_bisect_first_parent(), "\n");
+
if (no_checkout) {
if (get_oid(start_head.buf, &oid) < 0) {
res = error(_("invalid ref: '%s'"), start_head.buf);
@@ -631,7 +638,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
BISECT_TERMS,
BISECT_START
} cmdmode = 0;
- int no_checkout = 0, res = 0, nolog = 0;
+ int res = 0, nolog = 0;
struct option options[] = {
OPT_CMDMODE(0, "next-all", &cmdmode,
N_("perform 'git bisect next'"), NEXT_ALL),
@@ -653,8 +660,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
N_("print out the bisect terms"), BISECT_TERMS),
OPT_CMDMODE(0, "bisect-start", &cmdmode,
N_("start the bisect session"), BISECT_START),
- 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")),
OPT_END()
@@ -670,7 +675,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
switch (cmdmode) {
case NEXT_ALL:
- res = bisect_next_all(the_repository, prefix, no_checkout);
+ res = bisect_next_all(the_repository, prefix);
break;
case WRITE_TERMS:
if (argc != 2)
@@ -712,7 +717,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
break;
case BISECT_START:
set_terms(&terms, "bad", "good");
- res = bisect_start(&terms, no_checkout, argv, argc);
+ res = bisect_start(&terms, argv, argc);
break;
default:
return error("BUG: unknown subcommand '%d'", cmdmode);