git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/4] Add '--fixed-strings' option to "git log --grep" and friends

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 27, 2008, 01:03 UTC
Message-ID
<7vfxvf2osk.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1204028528-18941-2-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 15 quoted lines
> 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>
> ---
> This would simplify ignore-case searching for a fixed string from
> within gitweb, as gitweb wouldn't then have to deal with differences
> in quoting and unquoting (if you quote character which doesn't need
> quoting, would git (grep) unquote it?) between searched phrase,
> basic/extended regular expression as understood by git/by grep,
> and regular expressions in Perl (when showing matched info).
>
> [I am not sure if the above paragraph should be added to commit
> message, so it is in patch comments. Feel free to add it.] 

I do not understand the issue from reading that paragraph, so it probably means that (1) it does not help even if it is in the commit log message, and/or (2) more readable explanation may help in the commit log message ;-).

The rule for grep input should be known by anybody who writes scripts around grep, so I do not think this patch is absolutely necessary if this is only for gitweb. But for command line end-user usage, fixed string search _might be_ useful, although I've personally never felt need for that. So I am reluctant to see it grab a short-and-sweet -F option letter that might have better uses, but I do not have major objection against a more explicit --fixed-strings.

By the way, do you allow the default regexp search in gitweb? If so, how do you handle a malformed regexp that a user gives you? For example,

	$ git log --grep="don\('t" -1

barfs, and I suspect that you can catch the exit status 128 from die() and say something other than "nothing found" if you really wanted to.

Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 9 in “Improve gitweb search, and other things”
  1. 0/4 Improve gitweb search, and other thingsJakub Narebski, Feb 26, 2008
  2. 1/4 Add '--fixed-strings' option to "git log --grep" and friendsJakub Narebski, Feb 26, 2008
  3. Junio C HamanoFeb 27, 2008
  4. Jakub NarebskiFeb 27, 2008
  5. 1/4 Add '--fixed-strings' option to "git log --grep" and friendsJakub Narebski, Feb 27, 2008
  6. Junio C HamanoFeb 27, 2008
  7. 2/4 gitweb: Change parse_commits signature to allow for multiple optionsJakub Narebski, Feb 26, 2008
  8. 3/4 gitweb: Simplify fixed string searchJakub Narebski, Feb 26, 2008
  9. 4/4 gitweb: Clearly distinguish regexp / exact match searchesJakub Narebski, Feb 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.