From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 5880D1F8C6 for ; Sat, 11 Sep 2021 00:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234936AbhIKAQK (ORCPT ); Fri, 10 Sep 2021 20:16:10 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:57305 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233946AbhIKAQK (ORCPT ); Fri, 10 Sep 2021 20:16:10 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 10519E9022; Fri, 10 Sep 2021 20:14:58 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=y340CKGM5zBM IyP0r9dasEpbSfGkbhG1dxPQRzXlT2s=; b=jiRvdTdM1o7KivbqBoEuIDB8aSUP rro6XOlSLAxQ/GItCVQZgex/r7hN4iWCwF6avqInS3r7ceS5QLj5NbTURdMAEOo+ NIIg8IHgpTZY50HgDPu8//mz2HCaE2aiCYV5dKE5hpWcisnRiVd+KkbVyOj/e1/e /mwD+tddPbE29ak= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id E9FE2E9021; Fri, 10 Sep 2021 20:14:57 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.196.172.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 5F794E901F; Fri, 10 Sep 2021 20:14:57 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Jeff King , Carlo Arenas , Eric Sunshine Subject: Re: [PATCH v2 2/6] git.c: add a NEED_UNIX_SOCKETS option for built-ins References: Date: Fri, 10 Sep 2021 17:14:56 -0700 In-Reply-To: (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Fri, 10 Sep 2021 17:38:32 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: 4BE091A2-1295-11EC-92D5-62A2C8D8090B-77302942!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: > Change the implementation of b5dd96b70ac (make credential helpers > builtins, 2020-08-13) to declare in the "struct cmd_struct" that > NO_UNIX_SOCKETS can't be set. It may happen to be that two credential-cache program are both related to the same CPP macro NO_UNIX_SOCKETS, but I think the pattern you are tackling with this topic is that a fallback definition of a function that is designed to always die when invoked misuses the parse-options API. I do not want to see you invent a new bit in cmd_struct for each and every conditional that lets us define such a die-only fallback implementation. I may be missing something obvious, but can't the following suffice, and if not, why? Thanks. builtin/credential-cache--daemon.c | 9 --------- builtin/credential-cache.c | 9 --------- 2 files changed, 18 deletions(-) diff --git i/builtin/credential-cache--daemon.c w/builtin/credential-cach= e--daemon.c index 4c6c89ab0d..f11a89a89b 100644 --- i/builtin/credential-cache--daemon.c +++ w/builtin/credential-cache--daemon.c @@ -304,15 +304,6 @@ int cmd_credential_cache_daemon(int argc, const char= **argv, const char *prefix) =20 int cmd_credential_cache_daemon(int argc, const char **argv, const char = *prefix) { - const char * const usage[] =3D { - "git credential-cache--daemon [options] ", - "", - "credential-cache--daemon is disabled in this build of Git", - NULL - }; - struct option options[] =3D { OPT_END() }; - - argc =3D parse_options(argc, argv, prefix, options, usage, 0); die(_("credential-cache--daemon unavailable; no unix socket support")); } =20 diff --git i/builtin/credential-cache.c w/builtin/credential-cache.c index e8a7415747..dd794f84ce 100644 --- i/builtin/credential-cache.c +++ w/builtin/credential-cache.c @@ -142,15 +142,6 @@ int cmd_credential_cache(int argc, const char **argv= , const char *prefix) =20 int cmd_credential_cache(int argc, const char **argv, const char *prefix= ) { - const char * const usage[] =3D { - "git credential-cache [options] ", - "", - "credential-cache is disabled in this build of Git", - NULL - }; - struct option options[] =3D { OPT_END() }; - - argc =3D parse_options(argc, argv, prefix, options, usage, 0); die(_("credential-cache unavailable; no unix socket support")); } =20