v2-0001-Rename-silent-diff-to-check-in-pgindent.patch
text/x-patch
Filename: v2-0001-Rename-silent-diff-to-check-in-pgindent.patch
Type: text/x-patch
Part: 0
Message:
Re: Add --check option to pgindent
Patch
Format: format-patch
Series: patch v2-0001
Subject: Rename --silent-diff to --check in pgindent
| File | + | − |
|---|---|---|
| src/tools/pgindent/pgindent | 11 | 6 |
From f0963daa95b222b00a7ae15d6702141352d3a81d Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Mon, 11 Dec 2023 17:34:17 -0600
Subject: [PATCH v2 1/3] Rename --silent-diff to --check in pgindent
--check should be a little bit more self-explanatory for people coming
from other similar formatter/linting tooling.
---
src/tools/pgindent/pgindent | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index bce63d95da..fe0bd21f4a 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -23,7 +23,7 @@ my $devnull = File::Spec->devnull;
my ($typedefs_file, $typedef_str, @excludes,
$indent, $build, $show_diff,
- $silent_diff, $help, @commits,);
+ $check, $help, @commits,);
$help = 0;
@@ -35,13 +35,13 @@ my %options = (
"excludes=s" => \@excludes,
"indent=s" => \$indent,
"show-diff" => \$show_diff,
- "silent-diff" => \$silent_diff,);
+ "check" => \$check,);
GetOptions(%options) || usage("bad command line argument");
usage() if $help;
-usage("Cannot have both --silent-diff and --show-diff")
- if $silent_diff && $show_diff;
+usage("Cannot have both --check and --show-diff")
+ if $check && $show_diff;
usage("Cannot use --commit with command line file list")
if (@commits && @ARGV);
@@ -324,7 +324,7 @@ Options:
--excludes=PATH file containing list of filename patterns to ignore
--indent=PATH path to pg_bsd_indent program
--show-diff show the changes that would be made
- --silent-diff exit with status 2 if any changes would be made
+ --check exit with status 2 if any changes would be made
The --excludes and --commit options can be given more than once.
EOF
if ($help)
@@ -417,7 +417,12 @@ foreach my $source_filename (@files)
if ($source ne $orig_source)
{
- if ($silent_diff)
+ if ($check)
+ {
+ print show_diff($source, $source_filename);
+ exit 2;
+ }
+ elsif ($check)
{
exit 2;
}
--
Tristan Partin
Neon (https://neon.tech)