top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

git grep seems to use the wrong .gitattributes when invoked in a subdirectory

0 votes
45 views

I bumped into a problem where git grep thinks files in repo/a/data are binary files when it is invoked from repo/a and repo/data/.gitattributes contains "* binary".

I can reproduce this on 1.7.9.5 and 1.7.10.4. Unfortunately I don't have a newer version at hand.

How to reproduce:

[pseudo:~/tmp]% git --version
git version 1.7.10.4
[pseudo:~/tmp]% git init git-test
Initialized empty Git repository in /home/opqdonut/tmp/git-test/.git/
[pseudo:~/tmp]% cd git-test
[pseudo:~/tmp/git-test:master()]% mkdir -p a/data
[pseudo:~/tmp/git-test:master()]% mkdir data
[pseudo:~/tmp/git-test:master()]% echo '* binary' > data/.gitattributes
[pseudo:~/tmp/git-test:master()]% echo foo > a/data/foo
[pseudo:~/tmp/git-test:master()]% git add -A
[pseudo:~/tmp/git-test:master()]% git commit -m "foo"
[master (root-commit) 20fafbb] foo
 2 files changed, 1 insertion(+)
 create mode 100644 a/data/foo
 create mode 100644 data/.gitattributes
[pseudo:~/tmp/git-test:master()]% git grep foo
a/data/foo:foo
[pseudo:~/tmp/git-test:master()]% cd a
[pseudo:~/tmp/git-test/a:master()]% git grep foo
Binary file data/foo matches
posted May 23, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Just checked, with git 1.8.2.3 the last command shows a matching line.

The issue has probably been fixed by 55c6168 (grep: stop looking at random places for .gitattributes). The lowest release with that patch is git 1.8.0.1.

answer May 23, 2013 by anonymous
Similar Questions
0 votes

$ git push origin :ABRANCHNAME
remote: Firing Pre - receive hook
remote:
remote:
remote: Firing Post receive hook
remote:
remote: Branch is ABRANCHNAME -- not creating Trigger file since this is not _int branch
remote: error: Trying to write ref refs/tags/ABRANCHNAME!SN-BL-20130605_100513_04363 with nonexistent object 0000000000000000000000000000000000000000
remote: fatal: refs/tags/ABRANCHNAME!SN-BL-20130605_100513_04363: cannot update the ref
To ssh://git@ourgitserver/repositoryname.git
- [deleted] ABRANCHNAME

I would not expect this behavior. Is git attempting to modify the tags associated to the HEAD commit on the branch in addition to the branch? If so, I would like to consider this a bug report...

0 votes

I write here because since my ubuntu update (quantal to raring) and git update from 1.7.10.4-1ubuntu1 to 1.8.1.2

my export script doesn't work anymore.

I tried to put .gitattributes or .git/info/attributes, the file is the following http://pastebin.com/irngA1L8

the git is

git clone http://boinc.berkeley.edu/git/boinc-v2.git

and the command is

git archive --prefix boinc-7.1.7+dfsg/ --format tgz -o ../boinc_7.1.7+dfsg.orig.tar.gz -9 client_release/7.1/7.1.7

The archive gets created, but every file is inside, no exclusions at all.

I suspect a regression between git 1.7 and 1.8

0 votes

I have a local repository and a remote at GitHub. My local repo had a master branch and the remote had only a gh-pages branch.

I wanted to pull from my gh-pages remote branch (with "git pull origin gh-pages"). I was about to commit on the master branch and I realized I had no local gh-pages branch. So I put a blank message, to avoid commiting to the master branch.

I unstaged the changes with "git reset HEAD", but how can I remove the already fetched files. I mean, is there something I have to do after unstaging the fetched files?

Many thanks for your help,

+5 votes

I know form the "git log" we can now the commit time, but how to know when it is in the remote git server.

0 votes

When I update my branch from master it pulls down several files, including some sass files. When I compile, however, gulp alerts me that I am missing .scss files.

I tested this by creating a new fresh branch and running gulp sass. This time there were no errors and I saw the missing .scss had been brought in.

Would anyone know why, on update, I am only getting some of the files from master?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...