Skip to content

Commit

Permalink
Add '--fixed-strings' option to "git log --grep" and friends
Browse files Browse the repository at this point in the history
Add support for -F | --fixed-strings option to "git log --grep"
and friends: "git log --author", "git log --committer=<pattern>".
Code is based on implementation of this option in "git grep".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Feb 27, 2008
1 parent c6fabfa commit dc1c0ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Documentation/git-rev-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SYNOPSIS
[ \--(author|committer|grep)=<pattern> ]
[ \--regexp-ignore-case | \-i ]
[ \--extended-regexp | \-E ]
[ \--fixed-strings | \-F ]
[ \--date={local|relative|default|iso|rfc|short} ]
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
[ \--pretty | \--header ]
Expand Down
5 changes: 5 additions & 0 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ limiting may be applied.
Consider the limiting patterns to be extended regular expressions
instead of the default basic regular expressions.

-F, --fixed-strings::

Consider the limiting patterns to be fixed strings (don't interpret
pattern as a regular expression).

--remove-empty::

Stop when a given path disappears from the tree.
Expand Down
10 changes: 9 additions & 1 deletion revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
int left = 1;
int all_match = 0;
int regflags = 0;
int fixed = 0;

/* First, search for "--" */
seen_dashdash = 0;
Expand Down Expand Up @@ -1238,6 +1239,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
regflags |= REG_ICASE;
continue;
}
if (!strcmp(arg, "--fixed-strings") ||
!strcmp(arg, "-F")) {
fixed = 1;
continue;
}
if (!strcmp(arg, "--all-match")) {
all_match = 1;
continue;
Expand Down Expand Up @@ -1293,8 +1299,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
}
}

if (revs->grep_filter)
if (revs->grep_filter) {
revs->grep_filter->regflags |= regflags;
revs->grep_filter->fixed = fixed;
}

if (show_merge)
prepare_show_merge(revs);
Expand Down

0 comments on commit dc1c0ff

Please sign in to comment.