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

[BUG] git grep broken on master - won't work when merging

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Nov 5, 2007, 23:53 UTC
Message-ID
<46a038f90711051553p6202cc62wfda6b45ff7769984@mail.gmail.com>
Strange behaviour of git grep on one of the projects I hack on...
  $ git --version
  git version 1.5.3.5.561.g140d
  $ git grep LOB lib
  fatal: insanely many options to grep

After a bit of head-scratching I realised I was in the middle of a merge, with some unresolved paths in the lib directory. A bit of testing shows that the unresolved index is probably the problem:

  $ git grep LOB lib
  fatal: insanely many options to grep
  # an unresolved file
  $ git grep  LOB lib/accesslib.php
  fatal: insanely many options to grep
  $ git grep --cached LOB lib
  (... expected grep output...)
  $ git reset --hard
  $ git grep LOB lib
  (... expected grep output...)

... not sure what the correct behaviour should be -- I guess the most reasonable action would be to grep the files on disk for those unresolved paths. In any case, the error message is insanely many confusing to user! ;-)

Probably whitespace damaged...
diff --git a/builtin-grep.c b/builtin-grep.c
index c7b45c4..1831ef0 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -213,7 +213,7 @@ static int flush_grep(struct grep_opt *opt,
                 * arguments even for the call in the main loop.
                 */
                if (kept)
-                       die("insanely many options to grep");
+                       die("Unresolved index or too many options to grep");

                /*
                 * If we have two or more paths, we do not have to do


cheers,


martin
Next: Junio C Hamano
Message 1 of 3 in “[BUG] git grep broken on master - won't work when merging”
  1. Martin LanghoffNov 5, 2007
  2. Junio C HamanoNov 6, 2007
  3. Martin LanghoffNov 6, 2007

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.