Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdMh-00B4cK-WA for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Dec 2023 16:54:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rFdMg-003ThN-Mr for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Dec 2023 16:54:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdMg-003Tga-BB for pgsql-hackers@lists.postgresql.org; Tue, 19 Dec 2023 16:54:42 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rFdMd-00CpHW-CK for pgsql-hackers@postgresql.org; Tue, 19 Dec 2023 16:54:41 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5e734d6cbe4so16446057b3.3 for ; Tue, 19 Dec 2023 08:54:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon.tech; s=google; t=1703004878; x=1703609678; darn=postgresql.org; h=in-reply-to:references:from:to:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ulAlDLqcwHSmalLBRXJdLjA7Ig4tc0zOz8Iy+VUZpvg=; b=CkGXOhyMatkXzyShp3SMEXQr9RlWZ2Zl8U0+3hIJLtoDykf/QhLUKwEyqNVXCMzesx h1xIvi2tUbOWlBgPpCP376YmxQUMrkeMFJFgume7AsFzayM7bMuUV6zZu6owCN5B0a+5 WSIURJeFfgo4Tx75wT2kVsx+iLo2q9sJUv7Lc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703004878; x=1703609678; h=in-reply-to:references:from:to:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ulAlDLqcwHSmalLBRXJdLjA7Ig4tc0zOz8Iy+VUZpvg=; b=sYQZzmqQredxuTR4V5ojKQ+fPjUZGUOrAGE+SFoc14KkGgOjM/CDwURdwqLNpgq742 na2SVhu7GC+md39f1G3qXqdY2Cc3ey7QFz0ZoozmqrNRDovUNXEL6GzNmzBbWHUQ9kY/ PtnxxzqdBk71r6z+a4XtdLVEn8qpPJmR9e5eQj2SsZKYWjCNoJlWGpDpyAgwQKWBJ0gS Y9nhZGkbH7nUsBFvWF+WNR4KNeij540s1+5NUDgrUk+wmTIiUbd4AvTniPnTu5zxU+UT GLSnJj8GavLeNF/GjvpPQvIgQo7pZguhXtRSqqJ/Ci2T5C0uWZPQ2lh9AH8Xas68AJA9 cT3g== X-Gm-Message-State: AOJu0YzGvnavah3nqMAeZhJF0IiTAxeGP4nNNAArfEyr0o5cBgC6zhsm O44yrcnSuSh+FU9gu3LzUPsq/g== X-Google-Smtp-Source: AGHT+IGWABJlL3fXk6aiFIU1V17xMdkF1+wVzBgpI561X3VNvafTEtIuItAQxS/wyjhdC4E3pbvC7g== X-Received: by 2002:a81:8645:0:b0:5d7:1940:53de with SMTP id w66-20020a818645000000b005d7194053demr14400081ywf.86.1703004877714; Tue, 19 Dec 2023 08:54:37 -0800 (PST) Received: from localhost ([2600:1700:210:c270::3b]) by smtp.gmail.com with ESMTPSA id n19-20020a81af13000000b005e7d8d6e446sm475824ywh.93.2023.12.19.08.54.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Dec 2023 08:54:37 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Tue, 19 Dec 2023 10:54:36 -0600 Message-Id: Cc: "Daniel Gustafsson" , "Andrew Dunstan" , "Alvaro Herrera" , "Tom Lane" , "Euler Taveira" , "Michael Banck" , "PostgreSQL Hackers" Subject: Re: Add --check option to pgindent To: "Jelte Fennema-Nio" From: "Tristan Partin" X-Mailer: aerc 0.16.0-93-gbd29700e708d References: <202312121530.7vztxm3bfyrx@alvherre.pgsql> <4b390361-484d-7598-ac13-db2dd7072ad3@dunslane.net> <46DAFBD4-0387-4F8B-96A2-A39499600C32@yesql.se> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Dec 19, 2023 at 10:36 AM CST, Jelte Fennema-Nio wrote: > On Mon, 18 Dec 2023 at 22:18, Tristan Partin wrote: > > Here is an additional patch which implements the behavior you described= . > > The first patch is just Daniel's squashed version of my patches. > > I think we'd still want the early exit behaviour when only --check is > provided. No need to spend time checking more files if you're not > doing anything else. Good point. Patch looks good. > On Mon, 18 Dec 2023 at 22:34, Tristan Partin wrote: > > To me, the two options seem at odds, like you either check or write. Ho= w > > would you feel about just capturing the diffs that are printed and > > patch(1)-ing them? > > I tried capturing the diffs and patching them, but simply piping the > pgindent output to patch(1) didn't work because the pipe loses the > exit code of pgindent. -o pipefail would help with this, but it's not > available in all shells. Also then it's suddenly unclear if pgident > failed or if patch failed. I was envisioning something along the lines of: pgindent --check --diff > patches.txt status=3D$? patch