Code

git-rev-list: Add regexp tuning options
authorPetr Baudis <pasky@suse.cz>
Sat, 19 May 2007 00:13:29 +0000 (02:13 +0200)
committerJunio C Hamano <junkio@cox.net>
Mon, 21 May 2007 03:31:50 +0000 (20:31 -0700)
This patch introduces --extended-regexp and --regexp-ignore-case options to
tune what kind of patterns the pattern-limiting options (--grep, --author,
...) accept.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-rev-list.txt
revision.c

index c3c2043d183e0e6c7292f5af7c28af57958c4dcd..0dba73f27607560d3e868306af78bad83dc3bfff 100644 (file)
@@ -25,6 +25,7 @@ SYNOPSIS
             [ \--cherry-pick ]
             [ \--encoding[=<encoding>] ]
             [ \--(author|committer|grep)=<pattern> ]
+            [ \--regexp-ignore-case ] [ \--extended-regexp ]
             [ \--date={local|relative|default} ]
             [ [\--objects | \--objects-edge] [ \--unpacked ] ]
             [ \--pretty | \--header ]
@@ -214,6 +215,15 @@ limiting may be applied.
        Limit the commits output to ones with log message that
        matches the specified pattern (regular expression).
 
+--regexp-ignore-case::
+
+       Match the regexp limiting patterns without regard to letters case.
+
+--extended-regexp::
+
+       Consider the limiting patterns to be extended regular expressions
+       instead of the default basic regular expressions.
+
 --remove-empty::
 
        Stop when a given path disappears from the tree.
index 0125d41136871ad2cd07daaaabf40bd2f902a44f..0a29b53673e0e44547dfe91aaede5f312530a0ec 100644 (file)
@@ -881,6 +881,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
        const char **unrecognized = argv + 1;
        int left = 1;
        int all_match = 0;
+       int regflags = 0;
 
        /* First, search for "--" */
        seen_dashdash = 0;
@@ -1152,6 +1153,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                add_message_grep(revs, arg+7);
                                continue;
                        }
+                       if (!prefixcmp(arg, "--extended-regexp")) {
+                               regflags |= REG_EXTENDED;
+                               continue;
+                       }
+                       if (!prefixcmp(arg, "--regexp-ignore-case")) {
+                               regflags |= REG_ICASE;
+                               continue;
+                       }
                        if (!strcmp(arg, "--all-match")) {
                                all_match = 1;
                                continue;
@@ -1200,6 +1209,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                }
        }
 
+       if (revs->grep_filter)
+               revs->grep_filter->regflags |= regflags;
+
        if (show_merge)
                prepare_show_merge(revs);
        if (def && !revs->pending.nr) {