{"thread":{"id":"28733","subject":"git grep --no-index and absolute paths don't work?","startedAt":"2011-10-21T06:34:10Z","lastAt":"2011-10-21T17:35:23Z","messageCount":6,"participants":["Bert Wesarg","Carlos Martín Nieto","Lars Noschinski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"178111","messageId":"CAKPyHN138OZRt_3PT5ChuTpSEuOdybnyAj8Baqr=3OD=y==jgw@mail.gmail.com","threadId":"28733","inReplyTo":null,"subject":"git grep --no-index and absolute paths don't work?","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-21T06:34:10Z","receivedAt":"2011-10-21T06:34:10Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Hi,\n\nI'm currently  totally confused, that a\n\n    git grep --no-index foo /usr/include\n\ndoes not work. I know that the documentation says \"in the current\ndirectory\" for the --no-index flag. But this does not work ether:\n\n    cd ~; git grep --no-index foo ~/.bashrc\n\nThey all fail with 'is outside repository'. Which is for itself vary\nmisleading, because I intentionally said --no-index.\n\nAny input is appreciate.\n\nThanks.\n\nBert\n"},{"id":"178113","messageId":"1319180973.5352.8.camel@bee.lab.cmartin.tk","threadId":"28733","inReplyTo":"CAKPyHN138OZRt_3PT5ChuTpSEuOdybnyAj8Baqr=3OD=y==jgw@mail.gmail.com","subject":"Re: git grep --no-index and absolute paths don't work?","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2011-10-21T07:09:33Z","receivedAt":"2011-10-21T07:09:33Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Fri, 2011-10-21 at 08:34 +0200, Bert Wesarg wrote:\n> Hi,\n> \n> I'm currently  totally confused, that a\n> \n>     git grep --no-index foo /usr/include\n> \n> does not work. I know that the documentation says \"in the current\n> directory\" for the --no-index flag. But this does not work ether:\n\nThe rest of the sentence reads \", not just those tracked by git\" which\nimplies that the files tracked by git are also searched. This requires a\ngit repository.\n\n> \n>     cd ~; git grep --no-index foo ~/.bashrc\n> \n> They all fail with 'is outside repository'. Which is for itself vary\n> misleading, because I intentionally said --no-index.\n\nGit is a tool that works on git repositories. Some commands may work\noutside of a repository, like ls-remote when given an URL or init (for\nobvious reasons) but it's not something that should be expected,\nespecially for commands that read files from the working tree.\n\nWhy are you trying to use git's grep command outside a repository? Why\nisn't 'grep -nr foo /usr/include/' good enough?\n\n   cmn\n\n"},{"id":"178119","messageId":"20111021114952.GA2797@lars.home.noschinski.de","threadId":"28733","inReplyTo":"1319180973.5352.8.camel@bee.lab.cmartin.tk","subject":"Re: git grep --no-index and absolute paths don't work?","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2011-10-21T11:49:52Z","receivedAt":"2011-10-21T11:49:52Z","isPatch":false,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"* Carlos Martín Nieto <cmn@elego.de> [11-10-21 09:09]:\n> On Fri, 2011-10-21 at 08:34 +0200, Bert Wesarg wrote:\n> > I'm currently  totally confused, that a\n> > \n> >     git grep --no-index foo /usr/include\n> > \n> > does not work. I know that the documentation says \"in the current\n> > directory\" for the --no-index flag. But this does not work ether:\n> \n> The rest of the sentence reads \", not just those tracked by git\" which\n> implies that the files tracked by git are also searched. This requires a\n> git repository.\n\ngit grep --no-index works outside of git repositories (at least with\nrelative paths).\n\n> >     cd ~; git grep --no-index foo ~/.bashrc\n> > \n> > They all fail with 'is outside repository'. Which is for itself vary\n> > misleading, because I intentionally said --no-index.\n> \n> Git is a tool that works on git repositories. Some commands may work\n> outside of a repository, like ls-remote when given an URL or init (for\n> obvious reasons) but it's not something that should be expected,\n> especially for commands that read files from the working tree.\n> \n> Why are you trying to use git's grep command outside a repository? Why\n> isn't 'grep -nr foo /usr/include/' good enough?\n\nThere are a few nice things about git's grep, which GNU grep does not\nhave:\n\n  - automatic usage of pager\n  - support for pathspecs (can be emulated with `find ...`)\n  - support for boolean combinations of regular expressions\n\n  -- Lars.\n"},{"id":"178122","messageId":"CAKPyHN2hM9jDWkJwaP5ETfJnupQ6kAZjvAL_oaDumApup0-zOQ@mail.gmail.com","threadId":"28733","inReplyTo":"20111021114952.GA2797@lars.home.noschinski.de","subject":"Re: git grep --no-index and absolute paths don't work?","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-21T12:44:00Z","receivedAt":"2011-10-21T12:44:00Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Oct 21, 2011 at 13:49, Lars Noschinski\n<lars@public.noschinski.de> wrote:\n>  - automatic usage of pager\n>  - support for pathspecs (can be emulated with `find ...`)\n>  - support for boolean combinations of regular expressions\n- thread parallel\n\nbert\n"},{"id":"178129","messageId":"7vipni8el6.fsf@alter.siamese.dyndns.org","threadId":"28733","inReplyTo":"CAKPyHN138OZRt_3PT5ChuTpSEuOdybnyAj8Baqr=3OD=y==jgw@mail.gmail.com","subject":"Re: git grep --no-index and absolute paths don't work?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-21T17:00:21Z","receivedAt":"2011-10-21T17:00:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> I'm currently  totally confused, that a\n>\n>     git grep --no-index foo /usr/include\n>\n> does not work. I know that the documentation says \"in the current\n> directory\" for the --no-index flag.\n\nI think \"in the current directory\" is just contrasting with \"in the work\ntree, ...\" at the beginning of the DESCRIPTION section. We could say \"in\nthe files\" instead for clarity, and then add \"when pathspec is not given,\nfiles in the current directory is searched\" or something.\n\nThe intent of \"--no-index\", originating from \"git diff --no-index\", is to\nallow git tools to be used in non-git context, i.e. to files on the\nfilesystem.\n\n\"git grep --no-index\" which is a later invention in the 1.7.0 era didn't\nfully ignore \"git\"ness, and one such instance you fixed in this thread:\n\n    http://thread.gmane.org/gmane.comp.version-control.git/181484/focus=181485\n\nI think this path normalization is another instance of us knowing a bit too\nmuch of \"git\" even when we are told with \"--no-index\" that we are not\noperating on a working tree associated with git.\n"},{"id":"178135","messageId":"CAKPyHN3oLC-F2pBZtBu4494V5UR6-yALzCsTkDmG7-a13YCnng@mail.gmail.com","threadId":"28733","inReplyTo":"7vipni8el6.fsf@alter.siamese.dyndns.org","subject":"Re: git grep --no-index and absolute paths don't work?","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-21T17:35:23Z","receivedAt":"2011-10-21T17:35:23Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Oct 21, 2011 at 19:00, Junio C Hamano <gitster@pobox.com> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>> I'm currently  totally confused, that a\n>>\n>>     git grep --no-index foo /usr/include\n>>\n>> does not work. I know that the documentation says \"in the current\n>> directory\" for the --no-index flag.\n>\n> I think \"in the current directory\" is just contrasting with \"in the work\n> tree, ...\" at the beginning of the DESCRIPTION section. We could say \"in\n> the files\" instead for clarity, and then add \"when pathspec is not given,\n> files in the current directory is searched\" or something.\n>\n> The intent of \"--no-index\", originating from \"git diff --no-index\", is to\n> allow git tools to be used in non-git context, i.e. to files on the\n> filesystem.\n>\n> \"git grep --no-index\" which is a later invention in the 1.7.0 era didn't\n> fully ignore \"git\"ness, and one such instance you fixed in this thread:\n>\n>    http://thread.gmane.org/gmane.comp.version-control.git/181484/focus=181485\n>\n\nThats why I'm completely rattled after trying an absolute path with\n--no-index and it didn't worked.\n\n> I think this path normalization is another instance of us knowing a bit too\n> much of \"git\" even when we are told with \"--no-index\" that we are not\n> operating on a working tree associated with git.\n>\n\nSo we agree that this is a bug. Good. I will try to have a look into this.\n\nBert\n"}]}