Skip to content

scaffold generate --update strips trailing newlines (if any) from every merged file #2887

Description

@jorrite

Atmos version

1.225.0

Reproduction

# 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions