microsoft / ms-tpm-20-ref

Reference implementation of the TCG Trusted Platform Module 2.0 specification.
Other
339 stars 133 forks source link

Ensure that every source file ends with exactly one newline #76

Closed josephlr closed 2 years ago

josephlr commented 2 years ago

Many of the files lack trailing newlines, causing problems git diffs and similar tooling. A few files have multiple trailing newlines. This PR fixes both.

Newlines were added to files that didn't have them by running:

git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done

and then reverting any files we didn't want to change.

Duplicate trailing newlines were removed by running:

for f in *(.) TPMCmd/**/*(.); do
    if [[ "$f" =~ [.](md|c|h)$ ]]; then
        sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $f
    fi
done

which only affects 3 files.

josephlr commented 2 years ago

Closing as this conflicts with https://github.com/TrustedComputingGroup/TPM-Internal/pull/2

Once that formatting PR is resolved, we can also fix this formatting issue.