import subprocess, sys

P = "f6110c2a12df0dd50b87dfb60a2ec4120b5cf98d"
S = "a2f335f81e6a67f9aa9ea4e6e4bdfab44a1f9200"

for sha, label in ((P, "parent"), (S, "head")):
    for f in (".github/workflows/golden.yml", ".github/workflows/ci.yml"):
        raw = subprocess.run(["git", "cat-file", "blob", f"{sha}:{f}"],
                             capture_output=True).stdout
        cr = raw.count(b"\r")
        lf = raw.count(b"\n")
        crlf = raw.count(b"\r\n")
        print(f"{label:6} {f:34} bytes={len(raw):7} CR={cr:5} LF={lf:5} CRLF={crlf:5}")
print()
# Also: what does a shell-style grep count, to expose the quoting trap if there is one.
out = subprocess.run(["git", "cat-file", "blob", f"{S}:.github/workflows/ci.yml"],
                     capture_output=True).stdout.decode("utf-8", "replace")
lines = out.split("\n")
r_lines = sum(1 for l in lines if "r" in l)
print(f"ci.yml head: total lines(split \\n)={len(lines)} lines containing letter 'r'={r_lines}")
