Re: Three commit tips

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Three commit tips
Date: 2023-11-03 05:10:32
Message-ID: CAExHW5tEYPA5Xr_imV-8k7u_eaFO2n=DfEuBgtA6r4jVwduRww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 2, 2023 at 8:52 PM Bruce Momjian <bruce(at)momjian(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2023-11-03 05:28:43 Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock
Previous Message Peter Smith 2023-11-03 02:33:26 Re: A recent message added to pg_upgade