From: Tom Lane Date: Fri, 27 Mar 2026 19:38:48 +0000 (-0400) Subject: pgindent: ensure all C files end with a newline. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79ac82125ef6608b8a1c7e089eea17476537467c;p=thirdparty%2Fpostgresql.git pgindent: ensure all C files end with a newline. Not only is this good style, but it dodges some obscure bugs within pg_bsd_indent. We could try to fix said bugs, but the amount of effort required seems far out of proportion to the benefit. Reported-by: Akshay Joshi Author: Tom Lane Reviewed-by: Andrew Dunstan Discussion: https://postgr.es/m/CANxoLDfca8O5SkeDxB_j6SVNXd+pNKaDmVmEW+2yyicdU8fy0w@mail.gmail.com --- diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index 5f46aa46482..b2ec5e2914b 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -239,6 +239,9 @@ sub pre_indent { my $source = shift; + ## Ensure file ends with a newline (pg_bsd_indent messes up otherwise) + $source .= "\n" unless substr($source, -1) eq "\n"; + ## Comments # Convert // comments to /* */