Skip to content

Commit bb42dc9

Browse files
ZhongRuoyugitster
authored andcommitted
bisect: update usage and docs to match each other
Update the usage string of `git bisect` and documentation to match each other. While at it, also: 1. Move the synopsis of `git bisect` subcommands to the synopsis section, so that the test `t0450-txt-doc-vs-help.sh` can pass. 2. Document the `git bisect next` subcommand, which exists in the code but is missing from the documentation. See also: [1]. [1]: https://lore.kernel.org/git/[email protected]/ Suggested-by: Ben Knoble <[email protected]> Signed-off-by: Ruoyu Zhong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 57da342 commit bb42dc9

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

Documentation/git-bisect.adoc

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,22 @@ git-bisect - Use binary search to find the commit that introduced a bug
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git bisect' <subcommand> <options>
12+
'git bisect' start [--term-(bad|new)=<term-new> --term-(good|old)=<term-old>]
13+
[--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
14+
'git bisect' (bad|new|<term-new>) [<rev>]
15+
'git bisect' (good|old|<term-old>) [<rev>...]
16+
'git bisect' terms [--term-(good|old) | --term-(bad|new)]
17+
'git bisect' skip [(<rev>|<range>)...]
18+
'git bisect' next
19+
'git bisect' reset [<commit>]
20+
'git bisect' (visualize|view)
21+
'git bisect' replay <logfile>
22+
'git bisect' log
23+
'git bisect' run <cmd> [<arg>...]
24+
'git bisect' help
1325

1426
DESCRIPTION
1527
-----------
16-
The command takes various subcommands, and different options depending
17-
on the subcommand:
18-
19-
git bisect start [--term-(bad|new)=<term-new> --term-(good|old)=<term-old>]
20-
[--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
21-
git bisect (bad|new|<term-new>) [<rev>]
22-
git bisect (good|old|<term-old>) [<rev>...]
23-
git bisect terms [--term-(good|old) | --term-(bad|new)]
24-
git bisect skip [(<rev>|<range>)...]
25-
git bisect reset [<commit>]
26-
git bisect (visualize|view)
27-
git bisect replay <logfile>
28-
git bisect log
29-
git bisect run <cmd> [<arg>...]
30-
git bisect help
31-
3228
This command uses a binary search algorithm to find which commit in
3329
your project's history introduced a bug. You use it by first telling
3430
it a "bad" commit that is known to contain the bug, and a "good"
@@ -295,6 +291,19 @@ $ git bisect skip v2.5 v2.5..v2.6
295291
This tells the bisect process that the commits between `v2.5` and
296292
`v2.6` (inclusive) should be skipped.
297293

294+
Bisect next
295+
~~~~~~~~~~~
296+
297+
Normally, after marking a revision as good or bad, Git automatically
298+
computes and checks out the next revision to test. However, if you need to
299+
explicitly request the next bisection step, you can use:
300+
301+
------------
302+
$ git bisect next
303+
------------
304+
305+
You might use this to resume the bisection process after interrupting it
306+
by checking out a different revision.
298307

299308
Cutting down bisection by giving more parameters to bisect start
300309
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

builtin/bisect.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,35 @@ static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
2727
static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
2828

2929
#define BUILTIN_GIT_BISECT_START_USAGE \
30-
N_("git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]" \
31-
" [--no-checkout] [--first-parent] [<bad> [<good>...]] [--]" \
32-
" [<pathspec>...]")
33-
#define BUILTIN_GIT_BISECT_STATE_USAGE \
34-
N_("git bisect (good|bad) [<rev>...]")
30+
N_("git bisect start [--term-(bad|new)=<term-new> --term-(good|old)=<term-old>]\n" \
31+
" [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]")
32+
#define BUILTIN_GIT_BISECT_BAD_USAGE \
33+
N_("git bisect (bad|new|<term-new>) [<rev>]")
34+
#define BUILTIN_GIT_BISECT_GOOD_USAGE \
35+
N_("git bisect (good|old|<term-old>) [<rev>...]")
3536
#define BUILTIN_GIT_BISECT_TERMS_USAGE \
36-
"git bisect terms [--term-good | --term-bad]"
37+
"git bisect terms [--term-(good|old) | --term-(bad|new)]"
3738
#define BUILTIN_GIT_BISECT_SKIP_USAGE \
3839
N_("git bisect skip [(<rev>|<range>)...]")
3940
#define BUILTIN_GIT_BISECT_NEXT_USAGE \
4041
"git bisect next"
4142
#define BUILTIN_GIT_BISECT_RESET_USAGE \
4243
N_("git bisect reset [<commit>]")
4344
#define BUILTIN_GIT_BISECT_VISUALIZE_USAGE \
44-
"git bisect visualize"
45+
"git bisect (visualize|view)"
4546
#define BUILTIN_GIT_BISECT_REPLAY_USAGE \
4647
N_("git bisect replay <logfile>")
4748
#define BUILTIN_GIT_BISECT_LOG_USAGE \
4849
"git bisect log"
4950
#define BUILTIN_GIT_BISECT_RUN_USAGE \
5051
N_("git bisect run <cmd> [<arg>...]")
52+
#define BUILTIN_GIT_BISECT_HELP_USAGE \
53+
"git bisect help"
5154

5255
static const char * const git_bisect_usage[] = {
5356
BUILTIN_GIT_BISECT_START_USAGE,
54-
BUILTIN_GIT_BISECT_STATE_USAGE,
57+
BUILTIN_GIT_BISECT_BAD_USAGE,
58+
BUILTIN_GIT_BISECT_GOOD_USAGE,
5559
BUILTIN_GIT_BISECT_TERMS_USAGE,
5660
BUILTIN_GIT_BISECT_SKIP_USAGE,
5761
BUILTIN_GIT_BISECT_NEXT_USAGE,
@@ -60,6 +64,7 @@ static const char * const git_bisect_usage[] = {
6064
BUILTIN_GIT_BISECT_REPLAY_USAGE,
6165
BUILTIN_GIT_BISECT_LOG_USAGE,
6266
BUILTIN_GIT_BISECT_RUN_USAGE,
67+
BUILTIN_GIT_BISECT_HELP_USAGE,
6368
NULL
6469
};
6570

t/t0450/adoc-help-mismatches

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ add
22
am
33
apply
44
archive
5-
bisect
65
blame
76
branch
87
check-ref-format

0 commit comments

Comments
 (0)