On Mon, 18 Dec 2023 at 17:50, Tristan Partin <tris...@neon.tech> wrote:
> I could propose something. It would help if I had an example of such
> a tool that already exists.

Basically the same behaviour as what you're trying to add now for
--check, only instead of printing the diff it would actually change
the files just like running pgindent without a --check flag does. i.e.
allow pgindent --check to not run in "dry-run" mode
My pre-commit hook looks like this currently (removed boring cruft around it):

  if ! src/tools/pgindent/pgindent --check $files > /dev/null; then
    exit 0
  fi
  echo "Running pgindent on changed files"
  src/tools/pgindent/pgindent $files
  echo "Commit abandoned. Rerun git commit to adopt pgindent changes"
  exit 1

But I would like it to look like:

  if src/tools/pgindent/pgindent --check --write $files > /dev/null; then
    exit 0
  fi
  echo "Commit abandoned. Rerun git commit to adopt pgindent changes"
  exit 1


Reply via email to