Skip to content

Commit 3c03ee1

Browse files
committed
Doc: update src/tools/pgindent/README for current practice.
This README explains how to run pgindent, but it was written for our former practice of running pgindent only infrequently. Nowadays the plan is to keep the tree indent-clean all the time, so the typical thing is to do an incremental pgindent run with each commit. Revise to explain that as the normal case, and the infrequent full-on process as a separate thing. For now, pgperltidy is still a run-it-infrequently item.
1 parent a8f87d5 commit 3c03ee1

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

src/tools/pgindent/README

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
pgindent'ing the PostgreSQL source tree
22
=======================================
33

4-
We run this process at least once in each development cycle,
5-
to maintain uniform layout style in our C and Perl code.
4+
pgindent is used to maintain uniform layout style in our C and Perl code,
5+
and should be run for every commit. There are additional code beautification
6+
tasks which should be performed at least once per release cycle.
67

78
You might find this blog post interesting:
89
http://adpgtech.blogspot.com/2015/05/running-pgindent-on-non-core-code-or.html
@@ -25,45 +26,31 @@ PREREQUISITES:
2526
Or if you have cpanm installed, you can just use:
2627
cpanm https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20230309.tar.gz
2728

28-
DOING THE INDENT RUN:
2929

30-
1) Change directory to the top of the source tree.
31-
32-
2) Download the latest typedef file from the buildfarm:
30+
DOING THE INDENT RUN BEFORE A NORMAL COMMIT:
3331

34-
wget -O src/tools/pgindent/typedefs.list https://buildfarm.postgresql.org/cgi-bin/typedefs.pl
35-
36-
(See https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?show_list for a full
37-
list of typedef files, if you want to indent some back branch.)
32+
1) Change directory to the top of the source tree.
3833

39-
3) Run pgindent on the C files:
34+
2) Run pgindent on the C files:
4035

4136
src/tools/pgindent/pgindent .
4237

4338
If any files generate errors, restore their original versions with
4439
"git checkout", and see below for cleanup ideas.
4540

46-
4) Indent the Perl code using perltidy:
47-
48-
src/tools/pgindent/pgperltidy .
49-
50-
If you want to use some perltidy version that's not in your PATH,
51-
first set the PERLTIDY environment variable to point to it.
52-
53-
5) Reformat the bootstrap catalog data files:
54-
55-
./configure # "make" will not work in an unconfigured tree
56-
cd src/include/catalog
57-
make reformat-dat-files
58-
cd ../../..
59-
60-
VALIDATION:
61-
62-
1) Check for any newly-created files using "git status"; there shouldn't
41+
3) Check for any newly-created files using "git status"; there shouldn't
6342
be any. (pgindent leaves *.BAK files behind if it has trouble, while
6443
perltidy leaves *.LOG files behind.)
6544

66-
2) Do a full test build:
45+
4) If pgindent wants to change anything your commit wasn't touching,
46+
stop and figure out why. If it is making ugly whitespace changes
47+
around typedefs your commit adds, you need to add those typedefs
48+
to src/tools/pgindent/typedefs.list.
49+
50+
5) If you have the patience, it's worth eyeballing the "git diff" output
51+
for any egregiously ugly changes. See below for cleanup ideas.
52+
53+
6) Do a full test build:
6754

6855
make -s clean
6956
make -s all # look for unexpected warnings, and errors of course
@@ -75,14 +62,38 @@ VALIDATION:
7562
header files that get copied into ecpg output; if so, adjust the
7663
expected-files to match.
7764

78-
3) If you have the patience, it's worth eyeballing the "git diff" output
79-
for any egregiously ugly changes. See below for cleanup ideas.
8065

66+
AT LEAST ONCE PER RELEASE CYCLE:
67+
68+
1) Download the latest typedef file from the buildfarm:
69+
70+
wget -O src/tools/pgindent/typedefs.list https://buildfarm.postgresql.org/cgi-bin/typedefs.pl
71+
72+
This step resolves any differences between the incrementally updated
73+
version of the file and a clean, autogenerated one.
74+
(See https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?show_list for
75+
a full list of typedef files, if you want to indent some back branch.)
76+
77+
2) Run pgindent as above.
78+
79+
3) Indent the Perl code using perltidy:
80+
81+
src/tools/pgindent/pgperltidy .
82+
83+
If you want to use some perltidy version that's not in your PATH,
84+
first set the PERLTIDY environment variable to point to it.
85+
86+
4) Reformat the bootstrap catalog data files:
87+
88+
./configure # "make" will not work in an unconfigured tree
89+
cd src/include/catalog
90+
make reformat-dat-files
91+
cd ../../..
8192

82-
When you're done, "git commit" everything including the typedefs.list file
83-
you used.
93+
5) When you're done, "git commit" everything including the typedefs.list file
94+
you used.
8495

85-
4) Add the newly created commits to the .git-blame-ignore-revs file so
96+
6) Add the newly created commit(s) to the .git-blame-ignore-revs file so
8697
that "git blame" ignores the commits (for anybody that has opted-in
8798
to using the ignore file). Follow the instructions that appear at
8899
the top of the .git-blame-ignore-revs file.

0 commit comments

Comments
 (0)