Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
---
revision.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/revision.c b/revision.c
index 7db1109b57..0d34f81716 100644
--- a/revision.c
+++ b/revision.c
@@ -2387,6 +2387,23 @@ static int rev_opt_all(const struct option *opt, const
char *arg, int unset)
return 0;
}
+static int rev_opt_bisect(const struct option *opt,
+ const char *arg, int unset)
+{
+ struct rev_info *revs = opt->value;
+ int flags = *revs->pseudo_flags;
+ struct ref_store *refs = revs->pseudo_refs;
+
+ BUG_ON_OPT_NEG(unset);
+ BUG_ON_OPT_ARG(arg);
+ read_bisect_terms(&term_bad, &term_good);
+ handle_refs(refs, revs, flags, for_each_bad_bisect_ref);
+ handle_refs(refs, revs, flags ^ (UNINTERESTING | BOTTOM),
+ for_each_good_bisect_ref);
+ revs->bisect = 1;
+ return 0;
+}
+
static int rev_opt_branches(const struct option *opt,
const char *arg, int unset)
{
@@ -2427,6 +2444,9 @@ static void make_pseudo_options(struct rev_info *revs)
OPT_REV_OPTARG(0, "branches", N_("<pattern>"),
N_("include all refs in refs/heads (optionally
matches pattern)"),
rev_opt_branches),
+ OPT_REV_NOARG(0, "bisect",
+ N_("synonym to refs/bisect/good-* --not
refs/bisect/bad"),
+ rev_opt_bisect),
OPT_END()
};
ALLOC_ARRAY(revs->pseudo_options, ARRAY_SIZE(options));
@@ -2467,13 +2487,7 @@ static int handle_revision_pseudo_opt(const char
*submodule,
if (argc)
return argc;
- if (!strcmp(arg, "--bisect")) {
- read_bisect_terms(&term_bad, &term_good);
- handle_refs(refs, revs, *flags, for_each_bad_bisect_ref);
- handle_refs(refs, revs, *flags ^ (UNINTERESTING | BOTTOM),
- for_each_good_bisect_ref);
- revs->bisect = 1;
- } else if (!strcmp(arg, "--tags")) {
+ if (!strcmp(arg, "--tags")) {
handle_refs(refs, revs, *flags, refs_for_each_tag_ref);
clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--remotes")) {
--
2.21.0.1141.gd54ac2cb17