Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vayRj-00GjVU-3A for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Dec 2025 15:49:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vayQj-006lDg-0G for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Dec 2025 15:48:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vayQi-006lDY-28 for pgsql-hackers@lists.postgresql.org; Wed, 31 Dec 2025 15:48:09 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vayQf-003nGJ-2M for pgsql-hackers@lists.postgresql.org; Wed, 31 Dec 2025 15:48:08 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-4ed82ee9e57so143416751cf.0 for ; Wed, 31 Dec 2025 07:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1767196083; x=1767800883; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=MAMA81YNu+X2TMpgl/I4eIRtzWWR702NvHBtE7Xf7ag=; b=NUNO1D3v0SWAk1rLV1ooY1c/Ofj0jfTEga9l2zJj8pxodTvgIvuEVhbbUia//6obPK uy64bN8mdl9WClUoJxg6aXy8b3/ePRzrcZXxsIeq+1sS1c1xIhRmIKoCPckbRnk5zr2v jwBkjGTidsRNjZTBku/1fl6DDY3raM8MLVegsDoVKNdQANmVOoc7kvr0f90LN4cMb6Br 5K2Gu66L8QwglOrE8OApf0YDG/qOakuUrUwqn+QAMLyrK+TBfJDI70ftiQ4UXItRmqss W0KVJkJYn8ZpaiWD5TqSeQCsYwJKcM0E8QyDyhlZ/ypBG28lvgt8jwzfi+IzxeLREmYN j5jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767196083; x=1767800883; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MAMA81YNu+X2TMpgl/I4eIRtzWWR702NvHBtE7Xf7ag=; b=Gkox1z3g/Yl1iqf9xdbwlkqM7fbNnOgTLEscn+H+yCG61X9LVZJTZOXCVUUjY3z3U1 iBUpg/QinUMjyXCsflwkRuAXT4YP2me58lzt0ScR50t1SNTEioV+6xBI7Zmr8c/LN42K rz57JvqmQiZFHXiLWg19DrBcqMPmTLmXxRkC0h4Z88UiDk/KIeMa//nS5VEj37n1ueJH KIUyLUR+KN9mhYia+v7L2+jswTw5qlSJ1W3HTx8DV6kKTE8sDilbqAP+bWbjZhACtOxe GMrj/rn++cF+OORAQqQ28XTMv3Sxw7WohXsMXsd8VKtJ5e/85lzFAdr+xA0jTg6CdE+5 4Ckg== X-Forwarded-Encrypted: i=1; AJvYcCWew/xqdUcXI6BtEup7SH9DkQoj53A3Qxn0mqTlDOQIuRBZxeDwxI2eixQTTPjiR/u6bJ0OmL51s1vmdnJi@lists.postgresql.org X-Gm-Message-State: AOJu0Yyb+ezOKsVi8fwsMuzYISFkKsNt9CVkik30wGFXCVIYGAO/1f3F llEU9XuiHHBPfCPR2OmwNstrfUjXb/Cq0phFaA0Aa5eSgV4ySryobAa2xFziEvZa+R4= X-Gm-Gg: AY/fxX5avCzrMDnHgzr7Kw2hdBal9G+2J1iT9Zt12fR2jcYEETvGhq3Jy5mVMvuodT9 ldCOCZXH6eksj0uen+3JIqKNjRJGKdKJGGQkacwsALMd0q5SB8wJwWeowt6hEKXq22jiblQTyDs QuUe/z7j8IvFt2McjzrFIbQSGq7QQYOjFM7xDlwl4/PiLKRd7ADSdzMcZ3rvSePHBN2YVSwjrTJ 58rxc2cgomSm98iCUxLHoQZrxHy1/6wuK2cROyL4uj4VkwKAjrm6TYrBXAkNt724YLBk8jbYPhC wmNU/wuFX79dnl+tIlOXR50mPu/Nmbl1ZEIaa9zlUB9eusytiMrtEAqFNlJZ+YKvDW8hXKJqzPv KJg5hx196MnAgKaBW21qTQGr0tZ3nIiWt78ht8pNm4BamsZHsh7nnyIB3X1mCBowNPFdiP3BUD8 8BbG1OsYX37c6u8MLLtQ== X-Google-Smtp-Source: AGHT+IEZMNVtHpQJF8JK/r5veVA87duFJebavFRpuaPhuDIukkF7sGRJ/Rr6wTMxUUSooHnKCHUZbg== X-Received: by 2002:a05:622a:1889:b0:4f1:ac9c:9388 with SMTP id d75a77b69052e-4f4abbc6fabmr571146261cf.0.1767196083412; Wed, 31 Dec 2025 07:48:03 -0800 (PST) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id 6a1803df08f44-88d969fed73sm266610916d6.15.2025.12.31.07.48.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Dec 2025 07:48:02 -0800 (PST) Content-Type: multipart/alternative; boundary="------------omNWrPOkc3AfM0c26HZYUUWn" Message-ID: <5611b8aa-8496-4632-92b4-e096654850d1@dunslane.net> Date: Wed, 31 Dec 2025 10:48:00 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add "format" target to make and ninja to run pgindent and pgperltidy To: Tom Lane , Ashutosh Bapat Cc: Jelte Fennema-Nio , PostgreSQL Hackers , Daniel Gustafsson References: <3913298.1767194804@sss.pgh.pa.us> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAlwQTAQgAQQIbAwIX gAIZAQULCQgHAwUVCgkICwUWAgMBAAIeBRYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNGd BQkdEO8nAAoJEJn6f8tZ/DuBq74H/jkTR4Zi3stbw+xC7v2u3QozssK7MYPL2AsVfh7OealS h182fiWXpfvmmAB7WUHbhk9GC2RAOnHI/2d2jgKaMLAHsGYOT0YopTVIwRY43fCw/mK67yxc wmDcX+zyKfLaivNbf5A7QPLNwda98bEAMSJ8Sn652Uc6cA8t3uKGsVzbRBQOoYzjgvBCfSrE 9ql3PDNg0l4BfAqabd2f70ZUm9VAMEPrgv/v2xI7M2XiL4g5BVmqLCOwxLM8RMCotCuoweUr VO43DeBCIDwLxotMJKvGWDjBzQYlU1NPUAtNcz/gN9ITUe1VUGjyvGj4u1lxBOcQQUw7l1+T 5moZ4iZxXzvOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oKWaqf+wmW4tpDe/VV cxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7llV0xSSoFiieQBsr GvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8BoVrRFcdzlIY/NFN hFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C4R+M6w7o2PLGOjdZ +kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: <3913298.1767194804@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------omNWrPOkc3AfM0c26HZYUUWn Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025-12-31 We 10:26 AM, Tom Lane wrote: > Ashutosh Bapat writes: >> On Wed, Dec 31, 2025 at 5:06 PM Jelte Fennema-Nio wrote: >>> This tries to make running formatting a lot easier for committers, but >>> primarily for new contributors. >> I generally like the idea. Since perltidy is not enforced regularly >> (like pgindent), running it usually ends up modifying files which are >> not part of the patch. So I avoid it if not necessary. Do you propose >> to make it optional? > The other obstacle is that not everybody will have the right version > of perltidy installed, but using some other version will create a > whole lot of extraneous noise. pgperltidy actually checks the version now. > > On the whole I'd recommend not trying to automate the perltidy > step yet. Cost/benefit is just not very good. I'd kinda like to unify these universes, though. We could import the pgperltidy logic into pgindent but disable it unless some flag were given and the correct version of perltidy were present. > > On the substance of the patch: I wonder whether we could make things > more reliable by using git metadata to figure out which .h and .c > files to point pgindent at. > > The git pre-commit hook I use operates with this set of files:     files=$(git diff --cached --name-only --diff-filter=ACMR) pgindent just currently looks at that set of files and ignores everything that's not a .c or .h file. I guess what you're wanting is a test to see if the file is in git or a generated file? That doesn't really arise for me as I always do vpath builds, so generated files are always elsewhere. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------omNWrPOkc3AfM0c26HZYUUWn Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2025-12-31 We 10:26 AM, Tom Lane wrote:
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> writes:
On Wed, Dec 31, 2025 at 5:06 PM Jelte Fennema-Nio <postgres@jeltef.nl> wrote:
This tries to make running formatting a lot easier for committers, but
primarily for new contributors.

      
I generally like the idea. Since perltidy is not enforced regularly
(like pgindent), running it usually ends up modifying files which are
not part of the patch. So I avoid it if not necessary. Do you propose
to make it optional?
The other obstacle is that not everybody will have the right version
of perltidy installed, but using some other version will create a
whole lot of extraneous noise.



pgperltidy actually checks the version now.



On the whole I'd recommend not trying to automate the perltidy
step yet.  Cost/benefit is just not very good.


I'd kinda like to unify these universes, though. We could import the pgperltidy logic into pgindent but disable it unless some flag were given and the correct version of perltidy were present.



On the substance of the patch: I wonder whether we could make things
more reliable by using git metadata to figure out which .h and .c
files to point pgindent at.

			


The git pre-commit hook I use operates with this set of files:

    files=$(git diff --cached --name-only --diff-filter=ACMR)

pgindent just currently looks at that set of files and ignores everything that's not a .c or .h file.

I guess what you're wanting is a test to see if the file is in git or a generated file? That doesn't really arise for me as I always do vpath builds, so generated files are always elsewhere.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------omNWrPOkc3AfM0c26HZYUUWn--