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 1rCzzt-000Z7u-OZ for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Dec 2023 10:28:17 +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 1rCzzs-003OC4-D9 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Dec 2023 10:28:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCzzs-003OBw-2S for pgsql-hackers@lists.postgresql.org; Tue, 12 Dec 2023 10:28:16 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rCzzp-00A13M-6r for pgsql-hackers@postgresql.org; Tue, 12 Dec 2023 10:28:14 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-551c03ae050so216773a12.2 for ; Tue, 12 Dec 2023 02:28:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702376892; x=1702981692; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :subject:cc:to:from:date:sender:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Zq3VeWdJ+Y83YIPZZgVXM8Tg6C/Vva3zZvc/SnQ0Rqk=; b=NsPqnd7yR6VEXYr8HVwHBS/bTfSkVYi/raq/SNvFIlLSb/gSpfe6ekW9LZGNsWmuhT dZBCtpCc0aOeMAGGroj1uVXCNCmBof1miOVaFOYxP37Pb4Af1srWEKZnZ4HE3ax6qOYe UvaKDjIvAORJ3FZZ8xr+5LAMGt+5oeTXWVc1j+xBgeIpiPS+tY9fqEtlcsI6y37AUQIT hu84A6oY1cmIwmOuelNgYUuSWCNvJzVNj4RCdv0jIZmfFvs954Ef1IE40BpAY+pibiyN gSfo4Z7txVSguSMNNuYxWxMaaix9oQpbe8vEAX9Nf+mYwfhMjaT/7lJL8xvzBx0NJZH6 yggw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702376892; x=1702981692; h=user-agent:in-reply-to:content-disposition:mime-version:references :subject:cc:to:from:date:sender:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Zq3VeWdJ+Y83YIPZZgVXM8Tg6C/Vva3zZvc/SnQ0Rqk=; b=Qd/l/FmRir8xU33jD1A/YGUTGKR394zZzdqPpqBKhjyNszEOAm7Ra+Qd/3VvCGJz8P RF0hD4ROwPs9//2AlhHAk2P9Hdj4HYff7aTqge9UJfrPMQF4jhICD8DYe84GWA+qBVuw UhcbWhPNdFNliJYyBr9K5F4RNxJ7/27wXToJji58snbTfREAgkOs8O6m77aUvBNkTK1B o9ijJRPs6JCN/PfiPnLTyl1cG2CyP28627/IaUp76k8cESynZTp0/EwyLN51xQjtum64 9wsjFGYLnElxT8Nj9YZQzkNbhjj5c8miIjv4JSEVodOFUwBCJI4vqiNSDB3kHq5lIOK8 f5GQ== X-Gm-Message-State: AOJu0YxTDNOP4AOa52oWTttIUelG1PrbWsN9w2H7+dn3AQSSSeNquuhz q0KKEtZWt4YjrR2bCT3/bzA= X-Google-Smtp-Source: AGHT+IFyQuvGJwg0a8lFpM+Y9hfiII8hFvyNoHCbvFeEInug4o4FXmWc15dr2xG60E7Hp+DbdgNHtA== X-Received: by 2002:a50:c318:0:b0:54f:4882:cb2a with SMTP id a24-20020a50c318000000b0054f4882cb2amr90766edb.41.1702376891497; Tue, 12 Dec 2023 02:28:11 -0800 (PST) Received: from lightning.caipicrew.dd-dns.de ([2001:a61:3499:1001:fc21:8e26:c92:3672]) by smtp.gmail.com with ESMTPSA id e22-20020a50a696000000b0054c8f7708c9sm4795752edc.79.2023.12.12.02.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:28:11 -0800 (PST) Message-ID: <657835bb.500a0220.a88d.2058@mx.google.com> X-Google-Original-Message-ID: <20231212102810.GE25804@caipicrew.dd-dns.de;lightning.caipicrew.dd-dns.de> Sender: Michael Banck Received: from mbanck by lightning.caipicrew.dd-dns.de with local (Exim 4.92) (envelope-from ) id 1rCzzm-0005lt-JC; Tue, 12 Dec 2023 11:28:10 +0100 Date: Tue, 12 Dec 2023 11:28:10 +0100 From: Michael Banck To: Daniel Gustafsson Cc: Tristan Partin , PostgreSQL Hackers Subject: Re: Add --check option to pgindent References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, Dec 12, 2023 at 11:18:59AM +0100, Daniel Gustafsson wrote: > > On 12 Dec 2023, at 01:09, Tristan Partin wrote: > > > > Not sold on the name, but --check is a combination of --silent-diff > > and --show-diff. I envision --check mostly being used in CI > > environments. I recently came across a situation where this behavior > > would have been useful. Without --check, you're left to capture the > > output of --show-diff and exit 2 if the output isn't empty by > > yourself. > > I wonder if we should model this around the semantics of git diff to > keep it similar to other CI jobs which often use git diff? git diff > --check means "are there conflicts or issues" which isn't really > comparable to here, git diff --exit-code however is pretty much > exactly what this is trying to accomplish. > > That would make pgindent --show-diff --exit-code exit with 1 if there > were diffs and 0 if there are no diffs. To be honest, I find that rather convoluted; contrary to "git diff", I believe the primary action of pgident is not to show diffs, so I find the proposed --check option to be entirely reasonable from a UX perspective. On the other hand, tying a "does this need re-indenting?" question to a "--show-diff --exit-code" option combination is not very obvious (to me, at least). Cheers, Michael