reducing activity
reducing activity

Reputation: 2266

How git is guessing content type for purposes of end-of-line normalization?

According to the documentation on .gitattributes, text enables end-of-line normalization:

text

Setting the text attribute on a path enables end-of-line normalization and marks the path as a text file. End-of-line conversion takes place without guessing the content type.

I have list of extensions used in the project (git ls-tree -r HEAD --name-only | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u was used to find file types - from How can I find all of the distinct file extensions in a folder hierarchy? ).

Is there way to check whatever git recognizes each extension correctly as binary/text? Is it necessary to explicitly specify type of files or is Git usually handling it well?

Upvotes: 1

Views: 53

Answers (1)

CodeWizard
CodeWizard

Reputation: 142572

You can use something like:

file --mime package.json
# text file will print:
package.json: text/plain; charset=us-ascii


# binary file will print
file --mime logo.png
logo.png: image/png; charset=binary

Upvotes: 1

Related Questions