From: | "Tristan Partin" <tristan(at)neon(dot)tech> |
---|---|
To: | "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl> |
Cc: | "Daniel Gustafsson" <daniel(at)yesql(dot)se>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Euler Taveira" <euler(at)eulerto(dot)com>, "Michael Banck" <mbanck(at)gmx(dot)net>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add --check option to pgindent |
Date: | 2023-12-18 21:34:05 |
Message-ID: | CXRS5VNNIFMO.137GVG1RORYH2@neon.tech |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon Dec 18, 2023 at 11:21 AM CST, Jelte Fennema-Nio wrote:
> On Mon, 18 Dec 2023 at 17:50, Tristan Partin <tristan(at)neon(dot)tech> wrote:
> > I could propose something. It would help if I had an example of such
> > a tool that already exists.
>
> Basically the same behaviour as what you're trying to add now for
> --check, only instead of printing the diff it would actually change
> the files just like running pgindent without a --check flag does. i.e.
> allow pgindent --check to not run in "dry-run" mode
> My pre-commit hook looks like this currently (removed boring cruft around it):
>
> if ! src/tools/pgindent/pgindent --check $files > /dev/null; then
> exit 0
> fi
> echo "Running pgindent on changed files"
> src/tools/pgindent/pgindent $files
> echo "Commit abandoned. Rerun git commit to adopt pgindent changes"
> exit 1
>
> But I would like it to look like:
>
> if src/tools/pgindent/pgindent --check --write $files > /dev/null; then
> exit 0
> fi
> echo "Commit abandoned. Rerun git commit to adopt pgindent changes"
> exit 1
To me, the two options seem at odds, like you either check or write. How
would you feel about just capturing the diffs that are printed and
patch(1)-ing them?
--
Tristan Partin
Neon (https://neon.tech)
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2023-12-18 21:52:01 | Re: add non-option reordering to in-tree getopt_long |
Previous Message | Tristan Partin | 2023-12-18 21:18:47 | Re: Add --check option to pgindent |