I'm testing .gitattributes from D8 in D7, but I've the following errors:

$ git add sites/all/modules/contrib/coder
[attr]drupaltext    text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
 not allowed: trunk/.gitattributes:13
[attr]drupalbinary  -text diff
 not allowed: trunk/.gitattributes:18
warning: CRLF will be replaced by LF in trunk/sites/all/modules/contrib/coder/images/critical.png.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in trunk/sites/all/modules/contrib/coder/images/minor.png.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in trunk/sites/all/modules/contrib/coder/images/more.png.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in trunk/sites/all/modules/contrib/coder/images/normal.png.
The file will have its original line endings in your working directory.
Mac
git version 1.8.0

What I'm missing here?

Comments

stgaito’s picture

Status: Active » Closed (works as designed)

I realize that @kenorb's needs may have changed over the past 7 months, but I stumbled upon this problem as well. After reading the git source code (and re-reading the man page, https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html ), I realized that the problem is almost certainly the fact that the .gitattributes file we were both using was NOT in the top level directory of our projects.

DEFINING MACRO ATTRIBUTES Custom macro attributes can be defined only in the .gitattributes file at the toplevel (i.e. not in any subdirectory).

Certainly in my case, I am "braiding" (Ruby gem braid) the drupal core into a subdirectory of my own git project designed to help me track the development of Drupal8. Unfortunately, this means that drupal core's .gitattributes file no longer appears at the git repository's top-level.

Among other impacts, the fact that the [attr]drupalbinary macro is ignored, means that all sorts of *.png files look like they have been modified, when they haven't.

My solution is to move Drupal8's .gitattributes file into my top-level and .gitignore the (lack) of a copy at my braided drupal-core level.

Finally, for the regular git users out there, the Drupal instructions on how to install/configure git, http://drupal.org/documentation/git/configure , are important to understand.

kenorb’s picture

Thank you for the info, make sense.

mikeker’s picture