Re: Add --check option to pgindent

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Re: Add --check option to pgindent
Дата
Msg-id CAGECzQQnJbu=pfWYOeBrAMOF4is6tpRZm-feoWfQ8YtAJ-FsoQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add --check option to pgindent  ("Tristan Partin" <tristan@neon.tech>)
Ответы Re: Add --check option to pgindent  ("Tristan Partin" <tristan@neon.tech>)
Список pgsql-hackers
On Mon, 18 Dec 2023 at 17:50, Tristan Partin <tristan@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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock
Следующее
От: Robert Haas
Дата:
Сообщение: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock