git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 2, 2022, 09:09 UTC
Message-ID
<cover-v3-0.2-00000000000-20220602T090745Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.4-00000000000-20220520T072122Z-avarab@gmail.com>

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
-- 
2.36.1.1103.gb3ecdfb3e6a
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 20 of 26 in “What's cooking in git.git (Dec 2021, #04; Wed, 15)”
  1. Junio C HamanoDec 16, 2021
  2. ab/run-command (was: What's cooking in git.git (Dec 2021, #04; Wed, 15))Ævar Arnfjörð Bjarmason, Dec 16, 2021
  3. Jeff KingDec 16, 2021
  4. Ævar Arnfjörð BjarmasonDec 16, 2021
  5. Junio C HamanoDec 16, 2021
  6. 0/3 run-command.h: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, Apr 6, 2022
  7. 1/3 cocci: add a rename of "struct child_process"'s "env_array" to "env"Ævar Arnfjörð Bjarmason, Apr 6, 2022
  8. 2/3 run-command API: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, Apr 6, 2022
  9. 3/3 run-command API users: use "env" not "env_array" in comments & namesÆvar Arnfjörð Bjarmason, Apr 6, 2022
  10. Johannes SchindelinApr 7, 2022
  11. Junio C HamanoApr 7, 2022
  12. Junio C HamanoApr 7, 2022
  13. 0/4 run-command.h: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, May 20, 2022
  14. 1/4 cocci: add a rename of "struct child_process"'s "env_array" to "env"Ævar Arnfjörð Bjarmason, May 20, 2022
  15. 3/4 cocci: remove env_array -> env migrationÆvar Arnfjörð Bjarmason, May 20, 2022
  16. 4/4 run-command API users: use "env" not "env_array" in comments & namesÆvar Arnfjörð Bjarmason, May 20, 2022
  17. 2/4 run-command API: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, May 20, 2022
  18. Junio C HamanoMay 20, 2022
  19. Ævar Arnfjörð BjarmasonMay 21, 2022
  20. 0/2 run-command.h: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, Jun 2, 2022
  21. 2/2 run-command API users: use "env" not "env_array" in comments & namesÆvar Arnfjörð Bjarmason, Jun 2, 2022
  22. 1/2 run-command API: rename "env_array" to "env"Ævar Arnfjörð Bjarmason, Jun 2, 2022
  23. Junio C HamanoJun 3, 2022
  24. ab/make-dependency (was: What's cooking in git.git (Dec 2021, #04; Wed, 15))Ævar Arnfjörð Bjarmason, Dec 16, 2021
  25. Aleen 徐沛文Dec 21, 2021
  26. Christian CouderDec 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.