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

[PATCH v4 0/3] Remove the_repository global for am, annotate, apply, archive builtins

From
John Cai via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 10, 2024, 21:13 UTC
Message-ID
<pull.1788.v4.git.git.1728594828.gitgitgadget@gmail.com>
In-Reply-To
<pull.1788.v3.git.git.1728099043.gitgitgadget@gmail.com>

Remove the_repository global variable for the annotate, apply, and archive bulitins.

Changes since V3:
 * Improve commit message in patch 2
Changes since V1:
 * in patch 1, only pass in repo to the bulitin if the repo exists
Changes since V2:
 * drop patch 3, which is a bit more involved to dis-entangle the_repository
 * use a single variable in run_builtin() to keep track of whether or not we
   are operating in a repository
John Cai (3):
  git: pass in repo to builtin based on setup_git_directory_gently
  annotate: remove usage of the_repository global
  archive: remove the_repository global variable
 builtin/add.c      | 3 ++-
 builtin/annotate.c | 5 ++---
 builtin/archive.c  | 5 ++---
 git.c              | 7 ++++---
 4 files changed, 10 insertions(+), 10 deletions(-)
base-commit: 3857aae53f3633b7de63ad640737c657387ae0c6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1788%2Fjohn-cai%2Fjc%2Fremove-global-repo-a-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1788/john-cai/jc/remove-global-repo-a-v4
Pull-Request: https://github.com/git/git/pull/1788
Range-diff vs v3:
 1:  8009fdb38b0 = 1:  d59b85b5298 git: pass in repo to builtin based on setup_git_directory_gently
 2:  1b82b5dc678 ! 2:  f26d09215c3 annotate: remove usage of the_repository global
     @@ Metadata
       ## Commit message ##
          annotate: remove usage of the_repository global
      
     -    Remove the the_repository with the repository argument that gets passed
     -    down through the builtin function.
     +    As part of the effort to get rid of global state due to the_repository
     +    variable, remove the the_repository with the repository argument that
     +    gets passed down through the builtin function.
      
          Signed-off-by: John Cai <johncai86@gmail.com>
      
 3:  5d33a375f41 ! 3:  736212f34b5 archive: remove the_repository global variable
     @@ Metadata
       ## Commit message ##
          archive: remove the_repository global variable
      
     -    Replace the_repository with the repository argument that gets passed
     -    down through the builtin function.
     +    As part of the effort to get rid of global state due to the global
     +    the_repository variable, replace the_repository with the repository
     +    argument that gets passed down through the builtin function.
     +
     +    The repo might be NULL, but we should be safe in write_archive() because
     +    it detects if we are outside of a repository and calls
     +    setup_git_directory() which will error.
      
          Signed-off-by: John Cai <johncai86@gmail.com>
      
-- 
gitgitgadget
Previous: johncai86@gmail.comNext: John Cai via GitGitGadget
Message 40 of 44 in “Remove the_repository global for am, annotate, apply, archive builtins”
  1. 0/4 Remove the_repository global for am, annotate, apply, archive builtinsJohn Cai via GitGitGadget, Sep 24, 2024
  2. 1/4 git: pass in repo for RUN_SETUP_GENTLYJohn Cai via GitGitGadget, Sep 24, 2024
  3. shejialuoSep 24, 2024
  4. Junio C HamanoSep 24, 2024
  5. Junio C HamanoSep 24, 2024
  6. Patrick SteinhardtSep 26, 2024
  7. Junio C HamanoSep 26, 2024
  8. 2/4 annotate: remove usage of the_repository globalJohn Cai via GitGitGadget, Sep 24, 2024
  9. 3/4 apply: remove the_repository global variableJohn Cai via GitGitGadget, Sep 24, 2024
  10. Junio C HamanoSep 24, 2024
  11. Junio C HamanoSep 24, 2024
  12. John CaiSep 26, 2024
  13. Junio C HamanoSep 26, 2024
  14. 4/4 archive: remove the_repository global variableJohn Cai via GitGitGadget, Sep 24, 2024
  15. Junio C HamanoSep 24, 2024
  16. 0/4 Remove the_repository global for am, annotate, apply, archive builtinsJohn Cai via GitGitGadget, Sep 30, 2024
  17. 1/4 git: pass in repo for RUN_SETUP_GENTLYJohn Cai via GitGitGadget, Sep 30, 2024
  18. Junio C HamanoSep 30, 2024
  19. shejialuoOct 1, 2024
  20. 2/4 annotate: remove usage of the_repository globalJohn Cai via GitGitGadget, Sep 30, 2024
  21. Junio C HamanoSep 30, 2024
  22. 4/4 archive: remove the_repository global variableJohn Cai via GitGitGadget, Sep 30, 2024
  23. Junio C HamanoSep 30, 2024
  24. johncai86@gmail.comOct 4, 2024
  25. 3/4 apply: remove the_repository global variableJohn Cai via GitGitGadget, Sep 30, 2024
  26. Junio C HamanoSep 30, 2024
  27. shejialuoOct 1, 2024
  28. Patrick SteinhardtOct 1, 2024
  29. shejialuoOct 1, 2024
  30. Patrick SteinhardtOct 1, 2024
  31. Junio C HamanoOct 1, 2024
  32. johncai86@gmail.comOct 3, 2024
  33. 0/3 Remove the_repository global for am, annotate, apply, archive builtinsJohn Cai via GitGitGadget, Oct 5, 2024
  34. 1/3 git: pass in repo to builtin based on setup_git_directory_gentlyJohn Cai via GitGitGadget, Oct 5, 2024
  35. shejialuoOct 5, 2024
  36. 2/3 annotate: remove usage of the_repository globalJohn Cai via GitGitGadget, Oct 5, 2024
  37. 3/3 archive: remove the_repository global variableJohn Cai via GitGitGadget, Oct 5, 2024
  38. shejialuoOct 5, 2024
  39. johncai86@gmail.comOct 10, 2024
  40. 0/3 Remove the_repository global for am, annotate, apply, archive builtinsJohn Cai via GitGitGadget, Oct 10, 2024
  41. 1/3 git: pass in repo to builtin based on setup_git_directory_gentlyJohn Cai via GitGitGadget, Oct 10, 2024
  42. 2/3 annotate: remove usage of the_repository globalJohn Cai via GitGitGadget, Oct 10, 2024
  43. 3/3 archive: remove the_repository global variableJohn Cai via GitGitGadget, Oct 10, 2024
  44. Junio C HamanoOct 11, 2024

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.