Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295807

Relax .gitattributes global rule

$
0
0

Problem/Motivation

From .gitattributes:

# Auto-detect text files, ensure they use LF.
*         text=auto eol=lf

This line is wrecking havoc when adding themes or dependencies that contain binary files with CRLF line endings, such as font files (*.ttf). I just spent a couple of hours debugging an error I was getting in a custom theme for D8. The error was: "warning: CRLF will be replaced by LF in foobar.ttf". Removing that line from .gitattributes made the error go away.

To reproduce:

  • add this line to composer.json: "symfony/console": "2.6.*@dev",
  • composer update
  • git add core/vendor/symfony/console/
  • warning: CRLF will be replaced by LF in core/vendor/symfony/console/Symfony/Component/Console/Resources/bin/hiddeninput.exe.
    The file will have its original line endings in your working directory.

At the moment, we set a general rule that all files in git should use LF line endings, except for a handful of binary extension that we define at the end of .gitattributes. We shouldn't dictate how people should manage any possible file extension in git, we should only enforce the "Auto-detect text files, ensure they use LF." rules on the files that we know belong to Drupal. Having such a rule for all files is not going to scale for joe the developer (that was me today) who is using a theme that happens to include binary files that have the extension *.foobar and have CRLF line endings.

Proposed resolution

Remove the general rule for all extension, and only list the files we know should be versioned in Git (the way we have it now just below the * rule). As a result, we can remove the list of exceptions at the end of .gitattributes.

Remaining tasks

patch

User interface changes

n/a

API changes

n/a


Viewing all articles
Browse latest Browse all 295807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>