Re: run pgindent on a regular basis / scripted manner

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Noah Misch <noah(at)leadboat(dot)com>, Jelte Fennema <postgres(at)jeltef(dot)nl>, Peter Geoghegan <pg(at)bowt(dot)ie>, Bruce Momjian <bruce(at)momjian(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Jesse Zhang <sbjesse(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: run pgindent on a regular basis / scripted manner
Date: 2023-02-07 16:10:56
Message-ID: CA+TgmobWzN_P3WCdDR-sO9EzVWMFice8oViVCFUW+0T0mXiZKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 7, 2023 at 8:17 AM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> My git-fu is probably not all that it should be. I think we could possibly get at this list of files by running
>
> git status --porcelain --untracked-files=no --ignored=no -- .
>
> And then your --dirty list would be lines beginning with ' M' while your --cached list would be lines beginning with 'A[ M]'
>
> Does that seem plausible?

I don't know if that works or not, but it does seem plausible, at
least. My idea would have been to use the --name-status option, which
works for both git diff and git show. You just look and see which
lines in the output start with M or A and then take the file names
from those lines.

So to indent files that are dirty, you would look at:

git diff --name-status

For what's cached:

git diff --name-status --cached

For the combination of the two:

git diff --name-status HEAD

For a prior commit:

git show --name-status $COMMITID

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2023-02-07 16:24:44 Re: Too coarse predicate locks granularity for B+ tree indexes
Previous Message Hayato Kuroda (Fujitsu) 2023-02-07 16:07:07 RE: Exit walsender before confirming remote flush in logical replication