# git grep failure?

2 messages from 2019-08-21 to 2019-08-21. Participants: Wayne Walker.
Thread: https://gitlist.dev/t/51701

## Wayne Walker, 2019-08-21 03:32

Subject: git grep failure?
Message-ID: <CAJCsJ5fygkaB-=EoYC3EJ3HrBbGUW+cdsXTddUUEyBzT1TB+Zg@mail.gmail.com>
URL: https://gitlist.dev/e/CAJCsJ5fygkaB-%3DEoYC3EJ3HrBbGUW%2BcdsXTddUUEyBzT1TB%2BZg%40mail.gmail.com

```
I use git grep constantly.  Today it failed for me. It isn't looking
at all the files for some reason.  Am I somehow missing something?

midsizeschools@ut:~/tams (master u= origin/master)$ git ls-files | wc
    254     254   10062
midsizeschools@ut:~/tams (master u= origin/master)$ git grep -l . | wc
    250     250    9938
midsizeschools@ut:~/tams (master % u= origin/master)$ git grep -l . |
sort > b
midsizeschools@ut:~/tams (master % u= origin/master)$ git ls-files |
sort > a
midsizeschools@ut:~/tams (master % u= origin/master)$ diff a b
26,27d25
< app/models/tars_attendee.rb
< app/models/tars_district_registration.rb
144d141
< nbproject/private/config.properties
156d152
< public/favicon.ico

# git knows about the file:
~/tams (master u= origin/master)$ git ls-files | grep
app/models/tars_district_registration.rb
app/models/tars_district_registration.rb

# the string is found by grep in the file:
~/tams (master u= origin/master)$ grep accepts_nested_attributes_for
app/models/tars_district_registration.rb
accepts_nested_attributes_for :tars_attendees, :allow_destroy =>
false, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }

# but git grep doesn't find the file????
~/tams (master u= origin/master)$ git grep accepts_nested_attributes_for
~/tams (master u= origin/master)$

# git version is reasonably new - not my server, can't upgrade it
~/tams (master u= origin/master)$ git --version
git version 2.19.2

--
Wayne Walker
lwaynewalker@gmail.com

```

## Wayne Walker, 2019-08-21 04:04

Subject: Re: git grep failure?
Message-ID: <CAJCsJ5fVFiF_GOX30f7dF4D=Fh0gu0p2wPFtCC7EJY+wpSNU2Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAJCsJ5fVFiF_GOX30f7dF4D%3DFh0gu0p2wPFtCC7EJY%2BwpSNU2Q%40mail.gmail.com
In-Reply-To: <CAJCsJ5fygkaB-=EoYC3EJ3HrBbGUW+cdsXTddUUEyBzT1TB+Zg@mail.gmail.com>

```
Please ignore my previous email.  I have found what causes the
problem.  The files that it isn't matching against are symlinks (known
to git, but git grep apparently doesn't grep what they point to.

Sorry to have wasted anyone's time.

Wayne Walker

```
