You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scaffold generate --update strips trailing newlines (if any) from every merged file #2887
# 1. Generate a scaffold template with --git so it has a merge base.
atmos scaffold generate <any-template> ./out --defaults --git
# 2. Confirm the file has a trailing newline.
xxd ./out/some-file | tail -1 # ends in ...0a (trailing \n)# 3. Re-run --update with nothing changed on the template side (same source, same ref).
atmos scaffold generate <same-template> ./out --defaults --update
# 4. Compare.
xxd ./out/some-file | tail -1 # trailing \n is gone
This reproduces for every non-YAML file type merged through --update (Terraform, shell scripts, Markdown, arbitrary templates, etc.).
Expected
A file merged through --update, whether unchanged or genuinely updated by the template, should respect the original template's trailing newlines.--update should not unconditionally strip the final newline from every file it touches.
Impact
Every file atmos scaffold generate --update touches loses its trailing newline if there was any, unconditionally, regardless of file type or whether anything meaningful changed. This is the kind of change many linters, POSIX tools, and diff/patch tooling flag or warn on, and it produces a spurious one-line diff on every single managed file after every --update run.
Activity
osterman commentedon Aug 6, 2026
Agree, it should respect the trailing new line settings of incoming files. Hopefully this one is easier to fix.
jorrite commentedon Aug 6, 2026
Bit of a rough fix, but if we want to keep the diff3 lib we rely on now, this works. Took a bit of time before landing on this 😅.