Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

A .gitattribute file defines certain attributes that apply to files inside a directory.
It is recursive for all sub-directories that are part of this repository.

The purpose of the file is to improve the output of git diff, and to enforce proper line-endings for files in the repository.

File extensions are grouped into two categories, drupaltext and drupalbinary.
For drupaltext, treat the following as errors:

  • Trailing whitespace at the end of a line or tab character in the initial indent part of the line are treated as errors.
  • Spaces are always allowed at the beginning of a line.
  • Tabs, (while discouraged by our coding standards), are treated as 2 characters wide if present.
  • Blank lines at the end of a file are not flagged as errors.

For drupalbinary, always include the binary diff in a patch instead of "binary files differ".

Force all text files to use LF, files with CRLF line-endings will be prevented from being checked in.

Furthermore, PHP files are given more intelligent context in patch files. Primarily, this means that a diff of code inside a method will show that method, and not just the class, at the top of the hunk.

The following extensions are defined as text files:

  • *.css
  • *.engine
  • *.html
  • *.inc
  • *.info
  • *.install
  • *.js
  • *.json
  • *.lock
  • *.md
  • *.module
  • *.php
  • *.po
  • *.script
  • *.sh
  • *.sql
  • *.test
  • *.txt
  • *.xml
  • *.yml

The following extensions are defined as binary files:

  • *.gif
  • *.gz
  • *.ico
  • *.jpg
  • *.png
  • *.phar

If a module, library, theme, or install profile you use has files that do not meet these criteria, you can include your own .gitattributes file and override these settings manually.

Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done