Re: Three commit tips - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Three commit tips
Date
Msg-id CAExHW5tEYPA5Xr_imV-8k7u_eaFO2n=DfEuBgtA6r4jVwduRww@mail.gmail.com
Whole thread Raw
In response to Three commit tips  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Thu, Nov 2, 2023 at 8:52 PM Bruce Momjian <bruce@momjian.us> wrote:
>
> Third, I have come up with the following shell script to test for proper
> pgindentation, which I run automatically before commit:
>
>         #
https://www.postgresql.org/message-id/CAGECzQQL-Dbb%2BYkid9Dhq-491MawHvi6hR_NGkhiDE%2B5zRZ6vQ%40mail.gmail.com
>         src/tools/pgindent/pgindent $(git diff --name-only --diff-filter=ACMR) > /tmp/$$
>
>         if [ \( "$(wc -l < /tmp/$$)" -eq 1 -a "$(expr match "$(cat /tmp/$$)" "No files to process\>")" -eq 0 \) -o \
>              "$(wc -l < /tmp/$$)" -gt 1 ]
>         then    echo "pgindent failure in master branch, exiting." 1>&2
>                 cat /tmp/$$
>                 exit 1
>         fi
>

Looks useful. Git supports pre-push hook:
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks, a sample
script showing how to access the commits being pushed and other
arguments at https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample.
I have not used it. But it seems that your script can be used to
implement the pre-push hook.

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: A recent message added to pg_upgade
Next
From: Dilip Kumar
Date:
Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock