git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git grep broken on master - won't work when merging
@ 2007-11-05 23:53 Martin Langhoff
  2007-11-06  1:02 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Langhoff @ 2007-11-05 23:53 UTC (permalink / raw)
  To: git list

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [BUG] git grep broken on master - won't work when merging
  2007-11-05 23:53 [BUG] git grep broken on master - won't work when merging Martin Langhoff
@ 2007-11-06  1:02 ` Junio C Hamano
  2007-11-06  2:00   ` Martin Langhoff
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-11-06  1:02 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: git list

"Martin Langhoff" <martin.langhoff@gmail.com> writes:

> 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

I think 36f2587ffb6802cb38071510810f48cddfc4f34a (grep: do not
skip unmerged entries when grepping in the working tree.) is the
dud one.  Would this help?

diff --git a/builtin-grep.c b/builtin-grep.c
index c7b45c4..185876b 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -343,7 +343,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
 			memcpy(name + 2, ce->name, len + 1);
 		}
 		argv[argc++] = name;
-		if (argc < MAXARGS && !ce_stage(ce))
+		if (argc < MAXARGS)
 			continue;
 		status = flush_grep(opt, argc, nr, argv, &kept);
 		if (0 < status)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [BUG] git grep broken on master - won't work when merging
  2007-11-06  1:02 ` Junio C Hamano
@ 2007-11-06  2:00   ` Martin Langhoff
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Langhoff @ 2007-11-06  2:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git list

On 11/6/07, Junio C Hamano <gitster@pobox.com> wrote:
> I think 36f2587ffb6802cb38071510810f48cddfc4f34a (grep: do not
> skip unmerged entries when grepping in the working tree.) is the
> dud one.  Would this help?

Works great here! Thanks!

cheers,


martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-06  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 23:53 [BUG] git grep broken on master - won't work when merging Martin Langhoff
2007-11-06  1:02 ` Junio C Hamano
2007-11-06  2:00   ` Martin Langhoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).