A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
.gitattributes: text files check out with LF on every platform (fixes #405) (#407)
Eyal Golan85d8e5647605
diff --git a/.gitattributes b/.gitattributesnew file mode 100644index 000000000..87cc4d732--- /dev/null+++ b/.gitattributes@@ -0,0 +1,4 @@+# Text files check out with LF on every platform. Unity writes its YAML assets with LF, and the import tools and tests+# compare bytes, so a CRLF checkout (Git for Windows defaults to core.autocrlf=true) left files rewritten and tests+# failing (#405). Binary files are detected and left alone.+* text=auto eol=lfdiff --git a/scripts/oss/tests/test_line_endings.py b/scripts/oss/tests/test_line_endings.pynew file mode 100644index 000000000..0dcf9575b--- /dev/null+++ b/scripts/oss/tests/test_line_endings.py@@ -0,0 +1,31 @@+"""Text files check out with LF on every platform (#405). Git for Windows defaults to core.autocrlf=true, which checked+PORTRAITS.txt and PortraitCatalog.asset out with CRLF. PortraitImport and Unity then wrote them back with LF, so+PortraitImportTests.RunningTheImportAgainChangesNothing failed and the files showed as modified. .gitattributes pins LF;+these tests read it through git, so they fail wherever the rule is missing, not only on Windows."""+import subprocess+from pathlib import Path++ROOT = Path(__file__).resolve().parents[3]+PORTRAITS = "unity/Assets/UI/Portraits"+++def git(*args: str) -> str:+ return subprocess.run(["git", "-C", str(ROOT), *args], capture_output=True, check=True, text=True).stdout+++def test_text_files_check_out_with_lf_whatever_core_autocrlf_says():+ files = [f"{PORTRAITS}/PORTRAITS.txt", f"{PORTRAITS}/PortraitCatalog.asset", f"{PORTRAITS}/ben_gurion.jpg.meta",+ "unity/Assets/Materials/Terrain.mat", "content/people.yaml", "sim/Statecraft.sln"]+ out = git("check-attr", "eol", "--", *files)+ assert out.splitlines() == [f"{f}: eol: lf" for f in files]+++def test_no_tracked_file_is_stored_with_crlf():+ # With `text=auto` git would convert a CRLF blob on the next commit that touches it; none should be waiting.+ crlf = [line.split("\t", 1)[1] for line in git("ls-files", "--eol").splitlines() if line.startswith("i/crlf")]+ assert crlf == []+++def test_images_stay_binary():+ eol = git("ls-files", "--eol", "--", f"{PORTRAITS}/ben_gurion.jpg").split()+ assert eol[0] == "i/-text"