mbox series

[v3,0/2] run-command.h: rename "env_array" to "env"

Message ID cover-v3-0.2-00000000000-20220602T090745Z-avarab@gmail.com (mailing list archive)
Headers show
Series run-command.h: rename "env_array" to "env" | expand

Message

Ævar Arnfjörð Bjarmason June 2, 2022, 9:09 a.m. UTC
Follow-up 32ec72c3e1 (Merge branch 'ab/run-command', 2021-12-15) and
rename the "env_array" member to simply "env" in the "struct
child_process".

Changes since v2[1]:

 * Rebased on "master" (there was one small conflict).
 * Squashed the first 3 commits into one. Now the coccinelle rule is
   mentionid in the 1/2 commit message, instead of adding & removing
   it before/after the change itself.

1. https://lore.kernel.org/git/cover-v2-0.4-00000000000-20220520T072122Z-avarab@gmail.com/

Ævar Arnfjörð Bjarmason (2):
  run-command API: rename "env_array" to "env"
  run-command API users: use "env" not "env_array" in comments & names

 add-patch.c                 |  2 +-
 branch.c                    |  2 +-
 builtin/difftool.c          |  6 ++---
 builtin/receive-pack.c      | 32 +++++++++++++--------------
 builtin/stash.c             | 16 +++++++-------
 builtin/submodule--helper.c | 44 ++++++++++++++++++-------------------
 builtin/worktree.c          |  8 +++----
 connect.c                   |  9 ++++----
 connected.c                 |  2 +-
 daemon.c                    | 14 ++++++------
 editor.c                    |  2 +-
 hook.c                      |  2 +-
 http-backend.c              |  4 ++--
 object-file.c               |  2 +-
 pager.c                     |  4 ++--
 promisor-remote.c           |  2 +-
 run-command.c               | 19 ++++++++--------
 run-command.h               | 14 ++++++------
 sequencer.c                 | 18 +++++++--------
 submodule.c                 | 38 ++++++++++++++++----------------
 submodule.h                 |  4 ++--
 t/helper/test-run-command.c |  2 +-
 trailer.c                   |  2 +-
 transport-helper.c          |  2 +-
 wt-status.c                 |  2 +-
 25 files changed, 127 insertions(+), 125 deletions(-)

Range-diff against v2:
1:  e3f33fce566 < -:  ----------- cocci: add a rename of "struct child_process"'s "env_array" to "env"
2:  5aeb6ec9117 ! 1:  80ef05d5b0a run-command API: rename "env_array" to "env"
    @@ Metadata
      ## Commit message ##
         run-command API: rename "env_array" to "env"
     
    -    As noted in the preceding commit it would be nice to not deal with the
    -    oddity of having an "_array" suffix for the "env" strvec, but not for
    -    its "args" sibling.
    +    Start following-up on the rename mentioned in c7c4bdeccf3 (run-command
    +    API: remove "env" member, always use "env_array", 2021-11-25) of
    +    "env_array" to "env".
     
    -    We can do that with coccinelle in a way that's easy to review. The
    -    only manual changes in this commit are:
    +    The "env_array" name was picked in 19a583dc39e (run-command: add
    +    env_array, an optional argv_array for env, 2014-10-19) because "env"
    +    was taken. Let's not forever keep the oddity of "*_array" for this
    +    "struct strvec", but not for its "args" sibling.
     
    -     * git mv contrib/coccinelle/run_command{.pending,}.cocci
    -     * The change in run-command.h to rename the struct member itself, and
    -       to change its initializer.
    +    This commit is almost entirely made with a coccinelle rule[1]. The
    +    only manual change here is in run-command.h to rename the struct
    +    member itself and to change "env_array" to "env" in the
    +    CHILD_PROCESS_INIT initializer.
     
    -    The rest of this is all the result of a subsequent:
    +    The rest of this is all a result of applying [1]:
     
          * make contrib/coccinelle/run_command.cocci.patch
          * patch -p1 <contrib/coccinelle/run_command.cocci.patch
          * git add -u
     
    +    1. cat contrib/coccinelle/run_command.pending.cocci
    +       @@
    +       struct child_process E;
    +       @@
    +       - E.env_array
    +       + E.env
    +
    +       @@
    +       struct child_process *E;
    +       @@
    +       - E->env_array
    +       + E->env
    +
         I've avoided changing any comments and derived variable names here,
         that will all be done in the next commit.
     
    @@ builtin/receive-pack.c: static const char *push_to_deploy(unsigned char *sha1,
      	child.no_stdin = 1;
      	child.no_stdout = 1;
     @@ builtin/receive-pack.c: static const char *unpack(int err_fd, struct shallow_info *si)
    + 			close(err_fd);
      		return "unable to create temporary object directory";
      	}
    - 	if (tmp_objdir)
    --		strvec_pushv(&child.env_array, tmp_objdir_env(tmp_objdir));
    -+		strvec_pushv(&child.env, tmp_objdir_env(tmp_objdir));
    +-	strvec_pushv(&child.env_array, tmp_objdir_env(tmp_objdir));
    ++	strvec_pushv(&child.env, tmp_objdir_env(tmp_objdir));
      
      	/*
      	 * Normally we just pass the tmp_objdir environment to the child
    @@ connected.c: int check_connected(oid_iterate_fn fn, void *cb_data,
      	rev_list.no_stdout = 1;
      	if (opt->err_fd)
     
    - ## contrib/coccinelle/run_command.pending.cocci => contrib/coccinelle/run_command.cocci ##
    -
      ## daemon.c ##
     @@ daemon.c: static int upload_pack(const struct strvec *env)
      	strvec_pushl(&cld.args, "upload-pack", "--strict", NULL);
3:  ca09da570ef < -:  ----------- cocci: remove env_array -> env migration
4:  5419f839c74 = 2:  4039fec4f29 run-command API users: use "env" not "env_array" in comments & names