Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hash and immutable-file checks compare raw bytes, so text files must have the same line
# endings on every machine. Git's binary detection leaves images and archives alone.
* text=auto eol=lf
31 changes: 31 additions & 0 deletions tests/unit/test_line_endings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Hash and immutable-file checks read raw bytes, so a checkout must not convert line endings."""

from __future__ import annotations

import subprocess
from pathlib import Path

import pytest

pytestmark = pytest.mark.no_seeded_repo

REPO = Path(__file__).resolve().parents[2]


@pytest.mark.parametrize(
"path",
[
"content/mt/source_snapshots/mt.f352dcdea73daa036a807af6/source_tokens.json",
"content/audit/packages/source_policy.ab4537d9ff4ed35bb62e4059.json",
"app/services/greek_lexical_forms.py",
],
)
def test_byte_checked_files_check_out_with_lf(path: str) -> None:
result = subprocess.run(
["git", "check-attr", "eol", "--", path],
cwd=REPO,
capture_output=True,
text=True,
check=True,
)
assert result.stdout.strip() == f"{path}: eol: lf"
Loading