{"thread":{"id":"33907","subject":"Bug report: git grep seems to use the wrong .gitattributes when invoked in a subdirectory","startedAt":"2013-05-23T12:44:09Z","lastAt":"2013-05-23T15:49:35Z","messageCount":2,"participants":["Joel Kaasinen","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"218260","messageId":"CAK=EYX51G57borL_Hy2XzqJVML4wmAgOCBPwFLa+miDDY30O7Q@mail.gmail.com","threadId":"33907","inReplyTo":null,"subject":"Bug report: git grep seems to use the wrong .gitattributes when invoked in a subdirectory","fromName":"Joel Kaasinen","fromEmail":"joel.kaasinen@gmail.com","sentAt":"2013-05-23T12:44:09Z","receivedAt":"2013-05-23T12:44:09Z","isPatch":false,"sender":{"key":"joel.kaasinen@gmail.com","avatar":null},"body":"Greetings,\n\nI bumped into a problem where git grep thinks files in repo/a/data are\nbinary files when it is invoked from repo/a and\nrepo/data/.gitattributes contains \"* binary\".\n\nI can reproduce this on 1.7.9.5 and 1.7.10.4. Unfortunately I don't\nhave a newer version at hand.\n\nHow to reproduce:\n\n[pseudo:~/tmp]% git --version\ngit version 1.7.10.4\n[pseudo:~/tmp]% git init git-test\nInitialized empty Git repository in /home/opqdonut/tmp/git-test/.git/\n[pseudo:~/tmp]% cd git-test\n[pseudo:~/tmp/git-test:master()]% mkdir -p a/data\n[pseudo:~/tmp/git-test:master()]% mkdir data\n[pseudo:~/tmp/git-test:master()]% echo '* binary' > data/.gitattributes\n[pseudo:~/tmp/git-test:master()]% echo foo > a/data/foo\n[pseudo:~/tmp/git-test:master()]% git add -A\n[pseudo:~/tmp/git-test:master()]% git commit -m \"foo\"\n[master (root-commit) 20fafbb] foo\n 2 files changed, 1 insertion(+)\n create mode 100644 a/data/foo\n create mode 100644 data/.gitattributes\n[pseudo:~/tmp/git-test:master()]% git grep foo\na/data/foo:foo\n[pseudo:~/tmp/git-test:master()]% cd a\n[pseudo:~/tmp/git-test/a:master()]% git grep foo\nBinary file data/foo matches\n\n(Please CC me on replies, I'm not subscribed to the list.)\n\n--\nJoel Kaasinen\njoel.kaasinen@gmail.com\n"},{"id":"218278","messageId":"519E3A8F.9070600@lsrfire.ath.cx","threadId":"33907","inReplyTo":"CAK=EYX51G57borL_Hy2XzqJVML4wmAgOCBPwFLa+miDDY30O7Q@mail.gmail.com","subject":"Re: Bug report: git grep seems to use the wrong .gitattributes when invoked in a subdirectory","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2013-05-23T15:49:35Z","receivedAt":"2013-05-23T15:49:35Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 23.05.2013 14:44, schrieb Joel Kaasinen:\n> [pseudo:~/tmp]% git --version\n> git version 1.7.10.4\n> [pseudo:~/tmp]% git init git-test\n> Initialized empty Git repository in/home/opqdonut/tmp/git-test/.git/\n> [pseudo:~/tmp]% cd git-test\n> [pseudo:~/tmp/git-test:master()]% mkdir -p a/data\n> [pseudo:~/tmp/git-test:master()]% mkdir data\n> [pseudo:~/tmp/git-test:master()]% echo '* binary' > data/.gitattributes\n> [pseudo:~/tmp/git-test:master()]% echo foo > a/data/foo\n> [pseudo:~/tmp/git-test:master()]% git add -A\n> [pseudo:~/tmp/git-test:master()]% git commit -m \"foo\"\n> [master (root-commit) 20fafbb] foo\n>   2 files changed, 1 insertion(+)\n>   create mode 100644 a/data/foo\n>   create mode 100644 data/.gitattributes\n> [pseudo:~/tmp/git-test:master()]% git grep foo\n> a/data/foo:foo\n> [pseudo:~/tmp/git-test:master()]% cd a\n> [pseudo:~/tmp/git-test/a:master()]% git grep foo\n> Binary file data/foo matches\n\nJust checked, with git 1.8.2.3 the last command shows a matching line.\n\nThe issue has probably been fixed by 55c6168 (grep: stop looking at \nrandom places for .gitattributes).  The lowest release with that patch \nis git 1.8.0.1.\n\nRené\n"}]}