Akshay Joshi <akshay.joshi@enterprisedb.com> writes:
> I have addressed the review comments from Andrew.
> Attached is the v2 patch, ready for review.
I'm not sure I want to expend the brain cells to figure out whether
this is a correct/complete patch. If pg_bsd_indent were less of an
undercommented spaghetti-code nightmare, maybe fixing it here would
be reasonable. But as things stand, why don't we just fix this in
the perl wrapper, as attached?
(In any case, I'm not in favor of adding a test case, because that
would require putting a trailing-newline-less .c file into our tree.
At best there would be a permanent hazard of something "fixing"
the file.)
regards, tom lane
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 7481696a584..1081b28db8f 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -224,6 +224,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 /* */