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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 0A60E1F51E for ; Mon, 26 Sep 2022 19:18:08 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=pobox.com header.i=@pobox.com header.b="fbKdFCTx"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiIZTRM (ORCPT ); Mon, 26 Sep 2022 15:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbiIZTRI (ORCPT ); Mon, 26 Sep 2022 15:17:08 -0400 Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9ACF9A690 for ; Mon, 26 Sep 2022 12:17:06 -0700 (PDT) Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 002BA1CD17C; Mon, 26 Sep 2022 15:17:06 -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=T0RMPXRa0L/A g4Lk9se2pp7P4dVTbOsMgEqrPw+m2u0=; b=fbKdFCTxi17vYsQ7CnAgfAltrHUP 8WYnjBy39WOGZUcf9Md1/A/R35B+P8q/HPIsSc9zPvA3Z5Re5QjzwDHJe8TW8cLz tynvXZyua+VGk4rR9EaVbCS+tSezGIpg41PV6wo9YTwIVKRc7G4mKaTqwWnN1C/W xCM4q8alANEA3NQ= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id EDA6A1CD17B; Mon, 26 Sep 2022 15:17:05 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.83.5.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 2DEE81CD17A; Mon, 26 Sep 2022 15:17:02 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Derrick Stolee Cc: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , SZEDER =?utf-8?Q?G=C3=A1bor?= , Derrick Stolee via GitGitGadget , git@vger.kernel.org, vdye@github.com Subject: Re: [PATCH v2 1/2] maintenance: add 'unregister --force' References: <69c74f52eefd906c38494759a02e137e4d7c01d8.1663853837.git.gitgitgadget@gmail.com> <20220923130832.GA1761@szeder.dev> <220926.86mtamyvo7.gmgdl@evledraar.gmail.com> <22a767da-5ae0-5a8f-d5f4-f2c5cc217be4@github.com> Date: Mon, 26 Sep 2022 12:17:00 -0700 In-Reply-To: <22a767da-5ae0-5a8f-d5f4-f2c5cc217be4@github.com> (Derrick Stolee's message of "Mon, 26 Sep 2022 13:25:51 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Pobox-Relay-ID: CCCF6EC6-3DCF-11ED-B52B-C2DA088D43B2-77302942!pb-smtp20.pobox.com Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Derrick Stolee writes: > On 9/26/2022 11:39 AM, =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason wrote: >>=20 >> On Mon, Sep 26 2022, Derrick Stolee wrote: >>=20 >>> On 9/23/2022 9:08 AM, SZEDER G=C3=A1bor wrote: >>>> On Thu, Sep 22, 2022 at 01:37:16PM +0000, Derrick Stolee via GitGitG= adget wrote: >>>>> static int maintenance_unregister(int argc, const char **argv, con= st char *prefix) >>>>> { >>>>> + int force =3D 0; >>>>> struct option options[] =3D { >>>>> + OPT_BOOL(0, "force", &force, >>>>> + N_("return success even if repository was not registered")), >>>> >>>> This could be shortened a bit by using OPT__FORCE() instead of >>>> OPT_BOOL(). OTOH, please make it a bit longer, and declare the opti= on >>>> with the PARSE_OPT_NOCOMPLETE flag to hide it from completion: >>> >>> Looks like I can do both like this: >>> >>> OPT__FORCE(&force, >>> N_("return success even if repository was not registered"), >>> PARSE_OPT_NOCOMPLETE), >>=20 >> I don't think PARSE_OPT_NOCOMPLETE is appropriate here. Yes we use it >> for most of --force, but in some non-destructive cases (e.g. "add") we >> don't. >>=20 >> This seems to be such a case, we'll destroy no data or do anything >> irrecoverable. It's really just a >> --do-not-be-so-anal-about-your-exit-code option. > > I agree, so I wasn't completely sold on PARSE_OPT_NOCOMPLETE. I'll use > your vote to not add that option. I am perfectly OK with that. Given that "git reset --hard" is not given nocomplete option, I do not see much point in "destructive ones are not completed" guideline in practice anyway. After all, "add --force" would be destructively removing the object name recorded for the path previously. Thanks for carefully thinking the UI remifications through.