mbox series

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

Message ID pull.1788.v4.git.git.1728594828.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series Remove the_repository global for am, annotate, apply, archive builtins | expand

Message

Philippe Blain via GitGitGadget Oct. 10, 2024, 9:13 p.m. UTC
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>

Comments

Junio C Hamano Oct. 11, 2024, 5:47 p.m. UTC | #1
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:

> 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

Will queue.  Thanks, all.