{"thread":{"id":"10677","subject":"[BUG] git grep broken on master - won't work when merging","startedAt":"2007-11-05T23:53:21Z","lastAt":"2007-11-06T02:00:32Z","messageCount":3,"participants":["Martin Langhoff","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"58456","messageId":"46a038f90711051553p6202cc62wfda6b45ff7769984@mail.gmail.com","threadId":"10677","inReplyTo":null,"subject":"[BUG] git grep broken on master - won't work when merging","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-11-05T23:53:21Z","receivedAt":"2007-11-05T23:53:21Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"Strange behaviour of git grep on one of the projects I hack on...\n\n  $ git --version\n  git version 1.5.3.5.561.g140d\n\n  $ git grep LOB lib\n  fatal: insanely many options to grep\n\nAfter a bit of head-scratching I realised I was in the middle of a\nmerge, with some unresolved paths in the lib directory. A bit of\ntesting shows that the unresolved index is probably the problem:\n\n  $ git grep LOB lib\n  fatal: insanely many options to grep\n\n  # an unresolved file\n  $ git grep  LOB lib/accesslib.php\n  fatal: insanely many options to grep\n\n\n  $ git grep --cached LOB lib\n  (... expected grep output...)\n\n  $ git reset --hard\n  $ git grep LOB lib\n  (... expected grep output...)\n\n... not sure what the correct behaviour should be -- I guess the most\nreasonable action would be to grep the files on disk for those\nunresolved paths. In any case, the error message is insanely many\nconfusing to user! ;-)\n\nProbably whitespace damaged...\n\ndiff --git a/builtin-grep.c b/builtin-grep.c\nindex c7b45c4..1831ef0 100644\n--- a/builtin-grep.c\n+++ b/builtin-grep.c\n@@ -213,7 +213,7 @@ static int flush_grep(struct grep_opt *opt,\n                 * arguments even for the call in the main loop.\n                 */\n                if (kept)\n-                       die(\"insanely many options to grep\");\n+                       die(\"Unresolved index or too many options to grep\");\n\n                /*\n                 * If we have two or more paths, we do not have to do\n\n\ncheers,\n\n\nmartin\n"},{"id":"58469","messageId":"7vlk9ckwyn.fsf@gitster.siamese.dyndns.org","threadId":"10677","inReplyTo":"46a038f90711051553p6202cc62wfda6b45ff7769984@mail.gmail.com","subject":"Re: [BUG] git grep broken on master - won't work when merging","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-06T01:02:24Z","receivedAt":"2007-11-06T01:02:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Martin Langhoff\" <martin.langhoff@gmail.com> writes:\n\n> Strange behaviour of git grep on one of the projects I hack on...\n>\n>   $ git --version\n>   git version 1.5.3.5.561.g140d\n>\n>   $ git grep LOB lib\n>   fatal: insanely many options to grep\n>\n> After a bit of head-scratching I realised I was in the middle of a\n> merge, with some unresolved paths in the lib directory. A bit of\n> testing shows that the unresolved index is probably the problem:\n>\n>   $ git grep LOB lib\n>   fatal: insanely many options to grep\n>\n>   # an unresolved file\n>   $ git grep  LOB lib/accesslib.php\n>   fatal: insanely many options to grep\n\nI think 36f2587ffb6802cb38071510810f48cddfc4f34a (grep: do not\nskip unmerged entries when grepping in the working tree.) is the\ndud one.  Would this help?\n\ndiff --git a/builtin-grep.c b/builtin-grep.c\nindex c7b45c4..185876b 100644\n--- a/builtin-grep.c\n+++ b/builtin-grep.c\n@@ -343,7 +343,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)\n \t\t\tmemcpy(name + 2, ce->name, len + 1);\n \t\t}\n \t\targv[argc++] = name;\n-\t\tif (argc < MAXARGS && !ce_stage(ce))\n+\t\tif (argc < MAXARGS)\n \t\t\tcontinue;\n \t\tstatus = flush_grep(opt, argc, nr, argv, &kept);\n \t\tif (0 < status)\n"},{"id":"58477","messageId":"46a038f90711051800l41e51a68r3e0ff98a7ace433@mail.gmail.com","threadId":"10677","inReplyTo":"7vlk9ckwyn.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git grep broken on master - won't work when merging","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-11-06T02:00:32Z","receivedAt":"2007-11-06T02:00:32Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 11/6/07, Junio C Hamano <gitster@pobox.com> wrote:\n> I think 36f2587ffb6802cb38071510810f48cddfc4f34a (grep: do not\n> skip unmerged entries when grepping in the working tree.) is the\n> dud one.  Would this help?\n\nWorks great here! Thanks!\n\ncheers,\n\n\nmartin\n"}]}