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-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, 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 218E01F66E for ; Thu, 27 Aug 2020 04:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbgH0EcG (ORCPT ); Thu, 27 Aug 2020 00:32:06 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:45592 "EHLO mail-ej1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbgH0EcF (ORCPT ); Thu, 27 Aug 2020 00:32:05 -0400 Received: by mail-ej1-f67.google.com with SMTP id si26so5790257ejb.12 for ; Wed, 26 Aug 2020 21:32:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EhFeTYa893ExITytSWBCcrBlamEzYR5OUWtUYLMEzfU=; b=pTbsInvQTPFeRatiHQZoqDJJ23y9lYOHbGG5mBFrjzn1zMtJoIH16IZqbIVsEQxJSZ Ig1cpopAm1+3i5Ov3dOkGnpzH9lW1+IhqeIFDE5/ME8Svi/1mJlVGpvtXGmeVKA0uExr 4GsV/ESNaaoYDNahiz6aPWM6vZwXZRv9YTPZawFNblQnOsxRQ6V1ne6EVkJhAE0CHU/h rjq1iVBdepRA9oJwmLbKI2l+fCnP9DtceG7yRbfGJVl60SUslXmpkM4SV/hg+pOYM0iv ma1iJ4dcc2looOtMjft51Ud3Iz0vUFa932iV+nDFTbVoYAABSE6VeYd/dF3fiwRmfOfo RhyA== X-Gm-Message-State: AOAM5307P8ITowGa4w6WfLxVRczc62QG5EkrZfCFICdDNfxbrknE3thh yRJLOBIFEKXeHPb9Jg+PFbDDv4HPZYe9uBTKWGw= X-Google-Smtp-Source: ABdhPJyUB/DmgvJky9w3voEaQ9T8yku5IH4/WRRoPNbNxTp/cmxVmj9iV3Zv8AmuiZE/e8LvR2F6jIvFIu2RQpIN5g0= X-Received: by 2002:a17:906:80da:: with SMTP id a26mr18444704ejx.311.1598502723721; Wed, 26 Aug 2020 21:32:03 -0700 (PDT) MIME-Version: 1.0 References: <20200826194650.4031087-1-gitster@pobox.com> <20200826194650.4031087-3-gitster@pobox.com> <20200827042157.GC3346457@coredump.intra.peff.net> In-Reply-To: <20200827042157.GC3346457@coredump.intra.peff.net> From: Eric Sunshine Date: Thu, 27 Aug 2020 00:31:52 -0400 Message-ID: Subject: Re: [PATCH] run_command: teach API users to use embedded 'args' more To: Jeff King Cc: Junio C Hamano , Git List Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Aug 27, 2020 at 12:22 AM Jeff King wrote: > I've actually considered dropping child_process.argv entirely. Having > two separate ways to do the same thing gives the potential for > confusion. [...] > > Likewise for child_process.env_array. builtin/worktree.c:add_worktree() is a case in which an environment strvec is built once and re-used for multiple run_command() invocations by re-assigning it to child_process.env before each run_command(). It uses child_process.env rather than child_process.env_array because run_command() clears child_process.env_array upon completion, which makes it difficult to reuse a prepared environment strvec repeatedly. Nevertheless, that isn't much of a reason to keep child_process.env. Refactoring add_worktree() a bit to rebuild the environment strvec on-demand wouldn't be very difficult.