Table of contents: ~~~~~~~~~~~~~~~~~~ [PATCH 1/4] Add '--fixed-strings' option to "git log --grep" and friends [PATCH 2/4] gitweb: Change parse_commits signature to allow for multiple options [PATCH 3/4] gitweb: Simplify fixed string search [PATCH 4/4] gitweb: Clearly distinguish regexp / exact match searches Description of series: ~~~~~~~~~~~~~~~~~~~~~~~ When testing earlier improvements to gitweb commit search (searching commit messages), I have noticed that searching for "don't" didn't find anything from gitweb, while 'git log --grep="don't"' returns quite a number of commits. After examination I have realized that it was caused by the fact that 'quotemeta' in Perl quotes also "'" (single quote character), and grep (which "git log --grep=<pattern>" uses) doesn't do the unquoting for unnecessary quoted characters. At first I have thought about implementing our own limited quoting subroutine, quoteregexmeta() to quote only regular expression meta-characters. The "grep" search (using git-grep) by default uses extended POSIX regexps, so there would be need also for quoteextremeta() subroutine, unless gitweb would pass '-E' option to "git log" when searching/limiting output. This unfortunately needs _three_ versions of search query: original search text, to be passed for "next page" links, fill default/current value of search form text (entry) field, and perhaps show in the page title; regexp quoted for grep, to be passed to "git log --grep" and friends or "git grep"; regexp quoted for Perl (we can use quotemeta() here) for showing match info (matched fragment). It is a bit complicated and error prone. (Well, maybe all that is not really necessary...) With git-grep search (tree search) and pickaxe search (diff search) it is easy, as pickaxe search is by default fixed strings search, and git-grep has -F / --fixed-strings option. Option which "git log --grep=<pattern>" was lacking... First commit in series adds then -F / --fixed-strings option for searching commit messages by git-log / git-rev-list. It was quite easy to do, thanks to well written infrastructure. This patch can be seen as standalone patch (adding option for consistency), and I have even send it as Message-Id: <200802241647.08871.jnareb@xxxxxxxxx> But I have thought the chance of it being accepted would be better if there were some use case for it. Therefore next commits in series makes use of just introduced ability to use --fixed-strings option to consider the limiting patterns to be fixed strings. For this we have to pass both --grep=$seachstring (or equivalent for other commit message search searchtypes) and --fixed-strings option. Therefore parse_commits() subroutine calling convention, which allowed to pass optionally only single extra option had to be changed. Meanwhile when looking at gitweb installed at http://repo.or.cz I seen that it includes checkbox to switch between fixed strings search, and regexp search. (IIRC patch was send to git mailing list, and lost somehow, not being resent enough for inclusion[*1*]). The repo.or.cz gitweb is based on 'next' branch of http://repo.or.cz/git/gitweb.git fork of git. This change also required more than one pattern limiting option to be passed down to git-rev-list. So I have then extracted this change, and put it as second commit in this series. This made it easy to implement fixed strings search in gitweb not by quoting regexp meta-characters, but by using just implemented --fixed-strings option. Finally I have though "why not", and cherry-picked Petr "Pasky" Baudis addition of fixed-strings/regexp search checkbox. This made last, fourth commit in this series. [*1*] Petr "Pasky" Baudis is much less active on git mailing list lately. Shortlog: ~~~~~~~~~ Jakub Narebski (3): Add '--fixed-strings' option to "git log --grep" and friends gitweb: Change parse_commits signature to allow for multiple options gitweb: Simplify fixed string search Petr Baudis (1): gitweb: Clearly distinguish regexp / exact match searches Diffstat: ~~~~~~~~~ Documentation/git-rev-list.txt | 1 + Documentation/rev-list-options.txt | 5 +++ gitweb/gitweb.perl | 58 +++++++++++++++++++++++------------ revision.c | 10 +++++- 4 files changed, 53 insertions(+), 21 deletions(-) -- 1.5.4.2 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html