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,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 BE9551F45A for ; Sun, 30 Oct 2022 11:43:11 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; secure) header.d=web.de header.i=@web.de header.b="DTUoBa8V"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiJ3LnK (ORCPT ); Sun, 30 Oct 2022 07:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiJ3LnJ (ORCPT ); Sun, 30 Oct 2022 07:43:09 -0400 Received: from mout.web.de (mout.web.de [212.227.15.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9185CB841 for ; Sun, 30 Oct 2022 04:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1667130180; bh=hUPIERufh2YPKYUYEFtjKEriqayeFlciFf3o4OX2rFY=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=DTUoBa8VGTqcdy0pknLcNcVY4lzElaNoIluMf3ARctN6od3YozP8PEc/e0JiUvz9b kW7XebAcFZ9cLVwoCAny9JrGraM1gOv2SpRatn958n57+HV3qs6p804Y+NT/oNUOxP mUH/G3QqSYI3PoEIWXRljLa8LAuMu75hbHI3gEowm5YnCmiUd19fuBRzej8OZX3W0D Kurq+RO0hUkZR5Q2xcEePGKFQXVvfnAkfFuJW0k94TZSGU4KPBV1dM0AACKyKW6Tbv L0XQi4o/Tc5VmWcXKTwAoTs9GWpcKpmYRzs5JrdtURmjRL/dtVGqJupjqfpmBwCq3i oIHEagQLNcY3A== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([79.203.23.191]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MXXRL-1oYG0B0tyR-00Yx7b; Sun, 30 Oct 2022 12:43:00 +0100 Message-ID: <1281ea52-cb10-638b-7612-8fa9dbecc31e@web.de> Date: Sun, 30 Oct 2022 12:42:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: [PATCH v2 01/12] merge: remove always-the-same "verbose" arguments Content-Language: en-US From: =?UTF-8?Q?Ren=c3=a9_Scharfe?= To: Git List Cc: Junio C Hamano , Taylor Blau , Jeff King , =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= References: <7407e074-4bd8-b351-7fa4-baf59b41880c@web.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:+Q4TZ8Gm4EnoECWdHuOiEDylQp3kBMmQZ2g+EL8ufoirGSY3aMC f8Hkfw0z9jPpQB2i7LktSY1O1b5QyTlAg/Be0MpXNFPZGmURJK4IGcHOpgsE7SvTedcIqeY IiXbSKF/vVSFrhk7o7OtLZxn+x6J463/36CqYTNKoVY9hJUAcvdUmGM5ci3WB/8SiUGogNL pYZFH1KFeYnjIOH2oPjRQ== UI-OutboundReport: notjunk:1;M01:P0:KJr2DI4Qqhg=;RqCuGGS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ify the code that builds the arguments for the "read-tree" invocation in reset_hard() and read_empty() to remove the "verbose" parameter. Before 172b6428d06 (do not overwrite untracked during merge from unborn branch, 2010-11-14) there was a "reset_hard()" function that would be called in two places, one of those passed a "verbose=3D1", the other a "verbose=3D0". After 172b6428d06 when read_empty() was split off from reset_hard() both of these functions only had one caller. The "verbose" in read_empty() would always be false, and the one in reset_hard() would always be true. There was never a good reason for the code to act this way, it happened because the read_empty() function was a copy/pasted and adjusted version of reset_hard(). Since we're no longer conditionally adding the "-v" parameter here (and we'd only add it for "reset_hard()" we'll be able to move to a simpler and safer run-command API in the subsequent commit. Signed-off-by: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason Signed-off-by: Ren=C3=A9 Scharfe =2D-- builtin/merge.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index 5900b81729..3bb49d805b 100644 =2D-- a/builtin/merge.c +++ b/builtin/merge.c @@ -345,14 +345,12 @@ static int save_state(struct object_id *stash) return rc; } -static void read_empty(const struct object_id *oid, int verbose) +static void read_empty(const struct object_id *oid) { int i =3D 0; const char *args[7]; args[i++] =3D "read-tree"; - if (verbose) - args[i++] =3D "-v"; args[i++] =3D "-m"; args[i++] =3D "-u"; args[i++] =3D empty_tree_oid_hex(); @@ -363,14 +361,13 @@ static void read_empty(const struct object_id *oid, = int verbose) die(_("read-tree failed")); } -static void reset_hard(const struct object_id *oid, int verbose) +static void reset_hard(const struct object_id *oid) { int i =3D 0; const char *args[6]; args[i++] =3D "read-tree"; - if (verbose) - args[i++] =3D "-v"; + args[i++] =3D "-v"; args[i++] =3D "--reset"; args[i++] =3D "-u"; args[i++] =3D oid_to_hex(oid); @@ -385,7 +382,7 @@ static void restore_state(const struct object_id *head= , { struct strvec args =3D STRVEC_INIT; - reset_hard(head, 1); + reset_hard(head); if (is_null_oid(stash)) goto refresh_cache; @@ -1470,7 +1467,7 @@ int cmd_merge(int argc, const char **argv, const cha= r *prefix) check_trust_level); remote_head_oid =3D &remoteheads->item->object.oid; - read_empty(remote_head_oid, 0); + read_empty(remote_head_oid); update_ref("initial pull", "HEAD", remote_head_oid, NULL, 0, UPDATE_REFS_DIE_ON_ERR); goto done; =2D- 2.38.1