pgindent to ignore build directories

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pgindent to ignore build directories
Date: 2026-09-24 14:20:59
Message-ID: fc77b35a-34c4-4229-82f1-8cf0ce67f276@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

A problem I'm having is that if I'm having a build directory inside the
source tree

meson setup build

(as is documented) and then run pgindent

src/tools/pgindent/pgindent .

it descends into the build directory and then chokes on various files in
there. (exclude_file_patterns doesn't help because those patterns are
applied relative to the source directory.)

A subproblem is that if pgindent fails on many files, it doesn't clean
up after itself but leaves many pgsrc*.BAK files lying around. The
first patch fixes that.

Then, my first idea was to add an option to pgindent to exclude
directories from being processed. Like

src/tools/pgindent/pgindent . --exclude-dir=build

The second patch implements that.

But then I had the idea that we could recognize build directories
automatically by checking what files they contain. The third patch
implements that. That way, my initial pgindent invocation above works
out of the box and I don't have to remember to enumerate the build
directories on the command line.

(So the second patch is maybe obsolete, but the third one builds on it,
so I left it in here for discussion. People seem to have a variety of
workflows, so let's see what everyone wants.)

Attachment Content-Type Size
0001-pgindent-Don-t-leave-a-.BAK-file-behind-when-pg_bsd_.patch text/plain 1.4 KB
0002-pgindent-Add-exclude-dir-option.patch text/plain 5.1 KB
0003-pgindent-Skip-build-directories-automatically.patch text/plain 3.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Trakshan Mishra 2026-09-24 14:24:50 Re: Request to expedite commitfest account cool-off
Previous Message Manu 2026-09-24 14:16:58 Re: ERROR: failed to find conversion function from unknown to text