Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 revision.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/revision.c b/revision.c
index 9cfa4dc151..b02cb4660b 100644
--- a/revision.c
+++ b/revision.c
@@ -2464,6 +2464,17 @@ static int rev_opt_glob(const struct option *opt,
        return 0;
 }
 
+static int rev_opt_not(const struct option *opt,
+                      const char *arg, int unset)
+{
+       struct rev_info *revs  = opt->value;
+
+       BUG_ON_OPT_NEG(unset);
+       BUG_ON_OPT_ARG(arg);
+       *revs->pseudo_flags ^= UNINTERESTING | BOTTOM;
+       return 0;
+}
+
 static int rev_opt_reflog(const struct option *opt,
                          const char *arg, int unset)
 {
@@ -2558,6 +2569,9 @@ static void make_pseudo_options(struct rev_info *revs)
                OPT_REV_NOARG(0, "indexed-objects",
                              N_("include all trees and blobs used by the 
index"),
                              rev_opt_indexed_objects),
+               OPT_REV_NOARG(0, "not",
+                             N_("reverse the meaning of '^' for all following 
revisions"),
+                             rev_opt_not),
                OPT_END()
        };
        ALLOC_ARRAY(revs->pseudo_options, ARRAY_SIZE(options));
@@ -2597,9 +2611,7 @@ static int handle_revision_pseudo_opt(const char 
*submodule,
        if (argc)
                return argc;
 
-       if (!strcmp(arg, "--not")) {
-               *flags ^= UNINTERESTING | BOTTOM;
-       } else if (!strcmp(arg, "--no-walk")) {
+       if (!strcmp(arg, "--no-walk")) {
                revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
        } else if (skip_prefix(arg, "--no-walk=", &optarg)) {
                /*
-- 
2.21.0.1141.gd54ac2cb17

Reply via email to