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=-3.7 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_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 9AC171F953 for ; Thu, 16 Dec 2021 12:20:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234132AbhLPMUw (ORCPT ); Thu, 16 Dec 2021 07:20:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230214AbhLPMUv (ORCPT ); Thu, 16 Dec 2021 07:20:51 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B781C061574 for ; Thu, 16 Dec 2021 04:20:51 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id y12so85348866eda.12 for ; Thu, 16 Dec 2021 04:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:references:user-agent:in-reply-to :message-id:mime-version; bh=bOVN3mO8elOzaW4YMQ8nqFFCy15aKuaBwl8bRDY6lgA=; b=iddSn55Tbo00mqFpYw+RwCTNSgXcO94AkU+4kbTwG6cL3xx3mF4fM+2bthgQn62T4G ff1HmgkTokD/jvRwb7l3DbLVEYORZF6giWPIK+3AFscWqAGB9Aiz/0boVxc5GV+mfGs1 181HnikcKLUgLx+ZdFc5cbb4DhPvVqRy16vqug2ELeJJdlW6ivQseo8zv4wLMu39Ogob RD9rbeY0xbi1Zhj9NfGV9GYUTNyej2EqUnpWufxuDVr7RuTXBBMZB5EwItBR1tB8nLCg JIoTS3lxYmPspfTMtb9fxAibvf8bbEtM5NHbQZloK7HEb57sBqQ1XMaUN9qVyr1na+7x siUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:references:user-agent :in-reply-to:message-id:mime-version; bh=bOVN3mO8elOzaW4YMQ8nqFFCy15aKuaBwl8bRDY6lgA=; b=SfX6cE0ro8NZlXFqCf9YY6EtAWZXr04UwZ6sk7HKajt0xyy4JKZAnMIZTh8J8fm9JA AXHwzitMyUx394wrBjW/Omjj0eZndiUVvDx8wwFSvRpJyknMQeX23OG1RKSrQl8Xz+VO xD/A/6AJwub5LmecWb4wnKHSj8t2O+NVLuZvAcsgLHS3chq8SDva31MWmCP7fu2FA6Zr PyTbAGdQ/SCNuOChlvNAUH8DeImuhN43H1SFoeJlWQ42H7dAiH1lToK3zB69EKeYQTzn BuFsKyIWUNV7k+dp3GoMNVzjUpRygkDx74b3zSIlX+fZW+VwGiyVqgRmZdjdsgZ8V8v+ C0cg== X-Gm-Message-State: AOAM533KckfrmHGn78d/0r2H+BJD7vdybICLOahhn6rqvnoEiIwAv9Bt rvdc/mPvJjki6hLQ3TXneFiGULsf0bQ= X-Google-Smtp-Source: ABdhPJy1HK2iVB29dDvTQ/VRyuBfkdpX+XD2J3sOLLEDiQd49ANOZu201SBNJqjDoaKZW0tRhMNa/Q== X-Received: by 2002:a17:906:9d03:: with SMTP id fn3mr15420671ejc.742.1639657249744; Thu, 16 Dec 2021 04:20:49 -0800 (PST) Received: from gmgdl (j120189.upc-j.chello.nl. [24.132.120.189]) by smtp.gmail.com with ESMTPSA id j4sm2361259edk.64.2021.12.16.04.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 04:20:49 -0800 (PST) Received: from avar by gmgdl with local (Exim 4.95) (envelope-from ) id 1mxpke-000MqD-MH; Thu, 16 Dec 2021 13:20:48 +0100 From: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason To: Junio C Hamano Cc: git@vger.kernel.org Subject: ab/run-command (was: What's cooking in git.git (Dec 2021, #04; Wed, 15)) Date: Thu, 16 Dec 2021 12:51:55 +0100 References: User-agent: Debian GNU/Linux bookworm/sid; Emacs 27.1; mu4e 1.6.10 In-reply-to: Message-ID: <211216.868rwkbv1b.gmgdl@evledraar.gmail.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Dec 15 2021, Junio C Hamano wrote: > [Graduated to 'master'] > [...] > * ab/run-command (2021-11-25) 9 commits > (merged to 'next' on 2021-12-07 at 5c0bedf853) > + run-command API: remove "env" member, always use "env_array" > + difftool: use "env_array" to simplify memory management > + run-command API: remove "argv" member, always use "args" > + run-command API users: use strvec_push(), not argv construction > + run-command API users: use strvec_pushl(), not argv construction > + run-command tests: use strvec_pushv(), not argv assignment > + run-command API users: use strvec_pushv(), not argv assignment > + upload-archive: use regular "struct child_process" pattern > + worktree: stop being overly intimate with run_command() internals > > API clean-up. > cf. <211130.86k0gpcpy2.gmgdl@evledraar.gmail.com> > cf. > source: Thanks! FWIW the tip commit mentioned that renaming "env_array" to "env" probably wasn't worth it, but having tried it just now I think it's probably a worthwhile follow-up at some point. The diff is just: diff --git a/run-command.h b/run-command.h index 2be5f5d6422..c5d44cc9a5c 100644 --- a/run-command.h +++ b/run-command.h @@ -73,7 +73,7 @@ struct child_process { * The memory in .env_array will be cleaned up automatically during * `finish_command` (or during `start_command` when it is unsuccessful). */ - struct strvec env_array; + struct strvec env; pid_t pid; int trace2_child_id; @@ -147,7 +147,7 @@ struct child_process { #define CHILD_PROCESS_INIT { \ .args = STRVEC_INIT, \ - .env_array = STRVEC_INIT, \ + .env = STRVEC_INIT, \ } /** Followed by a rather large mechanical change, but that change can almost entirely be done with this cocci rule: @@ struct child_process E; @@ - E.env_array + E.env @@ struct child_process *E; @@ - E->env_array + E->env The "almost" being that we'll also need this on top: builtin/submodule--helper.c | 2 +- run-command.c | 6 +++--- run-command.h | 10 +++++----- sequencer.c | 6 +++--- submodule.h | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) Which changes comments and function/variable names that refer to "env_array" to refer to "env". I won't submit it now because we've got some "env_array" in master..seen, but there'll probably be a time when there'll be none which might make it trivial. Or maybe you're not interested in either case, which is also fine. It's really not needed for anything other than to resolve the minor oddity that we have two "struct strvec"'s, "args" and "env_array". It's just a bit odd to have one with "_array" in the name, which is only because the now-removed "env" was taken at the time.