pgsql: pgindent: preserve blank lines around #else/#endif

Started by Bruce Momjianover 12 years ago9 messagescomitters
Jump to latest
#1Bruce Momjian
bruce@momjian.us

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/db98b313296d1d50f357d58fbcb6572ed1ab018f

Modified Files
--------------
src/tools/pgindent/pgindent | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Bruce Momjian (#1)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

Bruce Momjian wrote:

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

This is a bit of a mess. I now can't use 9.3's pgindent because it
wants to have pg_bsd_indent 1.2 installed, but I only have 1.3 because
the master branch requested it.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Alvaro Herrera (#2)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

Alvaro Herrera wrote:

Bruce Momjian wrote:

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

This is a bit of a mess. I now can't use 9.3's pgindent because it
wants to have pg_bsd_indent 1.2 installed, but I only have 1.3 because
the master branch requested it.

BTW did this commit, or other recent pgindent tweaks, have more
implications than we were aware of? I just tried running HEAD's
pgindent in 9.3 (in individual files) and among other changes I saw this
one:

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 17bbcb5..5595f47 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -624,6 +624,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
                }
                else if (def->defnamespace == NULL)
                    continue;
+
                else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
                    continue;

This seems an odd change to be making.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#4Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#2)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

On Thu, Feb 13, 2014 at 03:54:54PM -0300, Alvaro Herrera wrote:

Bruce Momjian wrote:

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

This is a bit of a mess. I now can't use 9.3's pgindent because it
wants to have pg_bsd_indent 1.2 installed, but I only have 1.3 because
the master branch requested it.

Uh, I never thought people ran pgindent on old branches. Why would you
want to do that? You can certainly use head pgindent on 9.3 and it
should output the same.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#5Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#3)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

On Thu, Feb 13, 2014 at 04:07:21PM -0300, Alvaro Herrera wrote:

Alvaro Herrera wrote:

Bruce Momjian wrote:

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

This is a bit of a mess. I now can't use 9.3's pgindent because it
wants to have pg_bsd_indent 1.2 installed, but I only have 1.3 because
the master branch requested it.

BTW did this commit, or other recent pgindent tweaks, have more
implications than we were aware of? I just tried running HEAD's
pgindent in 9.3 (in individual files) and among other changes I saw this
one:

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 17bbcb5..5595f47 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -624,6 +624,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
}
else if (def->defnamespace == NULL)
continue;
+
else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
continue;

This seems an odd change to be making.

I just tested pgindent in head against that file in 9.3 and head and
didn't see that additional blank line, which is cetainly odd.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Bruce Momjian (#4)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

Bruce Momjian wrote:

On Thu, Feb 13, 2014 at 03:54:54PM -0300, Alvaro Herrera wrote:

Bruce Momjian wrote:

pgindent: preserve blank lines around #else/#endif

This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.

This is a bit of a mess. I now can't use 9.3's pgindent because it
wants to have pg_bsd_indent 1.2 installed, but I only have 1.3 because
the master branch requested it.

Uh, I never thought people ran pgindent on old branches. Why would you
want to do that?

Well, I wanted to make sure that the commit is identically indented in
all branches, and I worked in 9.3 first (rather unusually, I have to
admit.)

You can certainly use head pgindent on 9.3 and it should output the
same.

Yeah, it worked, although see my other followup.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#5)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

Bruce Momjian <bruce@momjian.us> writes:

On Thu, Feb 13, 2014 at 04:07:21PM -0300, Alvaro Herrera wrote:

BTW did this commit, or other recent pgindent tweaks, have more
implications than we were aware of? I just tried running HEAD's
pgindent in 9.3 (in individual files) and among other changes I saw this
one:

diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 17bbcb5..5595f47 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -624,6 +624,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
}
else if (def->defnamespace == NULL)
continue;
+
else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
continue;

This seems an odd change to be making.

I just tested pgindent in head against that file in 9.3 and head and
didn't see that additional blank line, which is cetainly odd.

It doesn't do that for me either.

regards, tom lane

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#8Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#7)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

On Thu, Feb 13, 2014 at 03:52:02PM -0500, Tom Lane wrote:

else if (def->defnamespace == NULL)
continue;
+
else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
continue;

This seems an odd change to be making.

I just tested pgindent in head against that file in 9.3 and head and
didn't see that additional blank line, which is certainly odd.

It doesn't do that for me either.

We have to expand our pgindent testing in the southern hemisphere. ;-)

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#9Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Bruce Momjian (#8)
Re: pgsql: pgindent: preserve blank lines around #else/#endif

Bruce Momjian wrote:

On Thu, Feb 13, 2014 at 03:52:02PM -0500, Tom Lane wrote:

else if (def->defnamespace == NULL)
continue;
+
else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
continue;

This seems an odd change to be making.

I just tested pgindent in head against that file in 9.3 and head and
didn't see that additional blank line, which is certainly odd.

It doesn't do that for me either.

We have to expand our pgindent testing in the southern hemisphere. ;-)

Ah, I see how it happened -- I first messed up and called it by passing
pgindent itself as the first parameter:

/pgsql/source/HEAD/src/tools/pgindent/pgindent src/tools/pgindent/pgindent src/backend/access/common/reloptions.c # more files
(I probably used !! instead of !* to invoke the prior command arguments)

I then realized the mistake and removed that argument and used --typedef:
/pgsql/source/HEAD/src/tools/pgindent/pgindent --typedef=src/tools/pgindent/typedefs.list src/backend/access/common/reloptions.c

This leads to the diff I posted, perhaps because the "continue" is seen
as a typedef in the first run (not real sure about this. But if the
typedef list is wrong, anything can happen, right?)

Therefore please disregard the report.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers