Simplify/cleanup .gitattributes

This commit is contained in:
Aminda Suomalainen 2024-07-15 09:20:17 +03:00
parent f4ccde0924
commit d368558812
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q

90
.gitattributes vendored
View File

@ -1,80 +1,42 @@
# If file is text, use lf line-endings and let forges show it in repo
# languages. For more information: `man gitattributes`
* text=auto eol=lf linguist-detectable * text=auto eol=lf linguist-detectable
# doctoc doesn't support other line endings
*.md diff=markdown eol=lf
*.markdown diff=markdown eol=lf
# Suggestions for inevitably encountering .gitattributeless repositories when # Set for not-normalized/unmergeable diffable
# .gitattributes cannot be added: # files
# git config --global core.autocrlf input
# - `* text=auto` when there is no `.gitattributes`. In other words,
# commit eol=lf, check-out as it is.
# git config --global core.safecrlf warn
# - Warn if EOL change is irreversible.
# git config --global merge.renormalize true
# - Avoid merge-conflict when merging from .gitattributeless branch to
# .gitattributed branch
# This is the default "binary" macro attribute, but with diffing allowed.
# Use when file contains diffable text, but isn't actually plaintext and thus
# shouldn't have EOL conversion done.
[attr]binaryd diff -merge -text [attr]binaryd diff -merge -text
# Example:
#*.db binaryd
# Built-in diff patterns (disabled by default). The attribute `diff` implies # Windows
# `text` and the above attributes are inherited. *.reg text eol=crlf
# https://www.git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header *.bat text eol=crlf
# TODO *.ahk text eol=crlf
# diff=matlab
# diff=pascal # Files I want to exclude from language detection
*.{adb,ads} diff=ada package.json text linguist-vendored
pnpm-lock.yaml text linguist-vendored
# `man gitattributes`, "Defining a custom hunk-header"
# mainly here for being template
*.bibtex diff=bibtex *.bibtex diff=bibtex
*.cs diff=csharp *.cs diff=csharp
*.{c,cpp} diff=cpp *.c diff=cpp
*.cpp diff=cpp
*.css diff=css *.css diff=css
*.dts diff=dts *.dts diff=dts
*.{ex,exs} diff=elixir *.ex diff=elixir
*.{f90,f,for} diff=fortran *.exs diff=elixir
*.fountain diff=fountain
*.go diff=golang *.go diff=golang
*.html diff=html *.html diff=html
*.java diff=java *.java diff=java
*.{kt,kts} diff=kotlin *.kt diff=kotlin
*.{h,m,mm,M} diff=objc *.kts diff=kotlin
*.pl diff=perl *.pl diff=perl
*.php diff=php *.php diff=php
*.py diff=python *.py diff=python
*.rb diff=ruby *.rb diff=ruby
*.{rs,rlib} diff=rust *.rs diff=rust
*.{scm,ss} diff=scheme *.rlib diff=rust
*.scm diff=scheme
*.ss diff=scheme
*.tex diff=tex *.tex diff=tex
# bash & co aren't often Windows, so alway have lf line-endings regarldess
# of the above. Markdown is also included as I utilise doctoc, which
# requires lf line-endings.
*.{sh,bash,zsh} diff=bash eol=lf
*.{md,markdown,[mM][dD],[mM][aA][rR][kK][dD][oO][wW][nN]} diff=markdown eol=lf
# While this file is like .gitignore, negative patterns are forbidden and
# directory/ wouldn't recurse, thus directory/**. Also !attribute would set
# it back to unset.
# In this case Windows/** may also contain binary files, thus auto-detection
# is repeated and eol=crlf as it's unlikely to be of use outside of Windows.
Windows/** text=auto eol=crlf
# Similarly these files are unlikely to be encountered outside of Windows.
# The "text" attribute is used as otherwise they rely on auto-detection of
# textness since there is no diff attribute set.
# Ref: https://rehansaeed.com/gitattributes-best-practices/#line-endings
*.{reg,[rR][eE][gG]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{ahk,[aA][hH][kK]} text eol=crlf
# These files are scary, let's not touch them. The attribute "lockable" is
# provided by git-lfs. https://github.com/git-lfs/git-lfs/wiki/File-Locking
LICENSE text lockable
CITATION.cff text lockable
# NOTE! .gitattributes doesn't support the case-insensitive style above!
package.json text linguist-vendored
pnpm-lock.yaml text linguist-vendored