Re: run pgindent on a regular basis / scripted manner

From: Jelte Fennema <postgres(at)jeltef(dot)nl>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, shiy(dot)fnst(at)fujitsu(dot)com, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Noah Misch <noah(at)leadboat(dot)com>, 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-15 21:00:41
Message-ID: CAGECzQQZ4RCKqSJ9MQDs0Oo1U9M_8Pg_btwQZopDFQfWeUOPKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Also, it makes a more sense to "add" the file before indenting it, to
> allow checking the output and remove unrelated changes. So that doesn't
> seem to me like a restriction of any significance.

For my workflow it would be the same, but afaik there's two ways that
people commonly use git (mine is 1):
1. Adding changes/files to the staging area using and then committing
those changes:
git add (-p)/emacs magit/some other editor integration
2. Just add everything that's changed and commit all of it:
git add -A + git commit/git commit -a

For workflow 1, a --staged/--cached flag would be enough IMHO. But
that's not at all helpful for workflow 2. That's why I proposed
--uncommitted too, to make indenting easier for workflow 2.

> But I would never want to indent an untracked file unless I specified
> it.

Would the --uncommitted flag I proposed be enough of an explicit way
of specifying that you want to indent untracked files?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2023-02-15 21:08:59 [PATCH] FIx alloc_var() ndigits thinko
Previous Message Andres Freund 2023-02-15 20:49:47 Re: doc: add missing "id" attributes to extension packaging page