Skip to content

Remove the_repository global for am, annotate, apply, archive builtins

John Cai via GitGitGadget git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyIn review
  2. v33 patches 3 repliesSuperseded
  3. v24 patches 12 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches10 repliesSuperseded

Changes in v4 from the cover letter

* Improve commit message in patch 2

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3git: pass in repo to builtin based on setup_git_directory_gentlybuiltin/add.c git.c+6 -40 replies
2/3annotate: remove usage of the_repository globalbuiltin/annotate.c+2 -30 replies
3/3archive: remove the_repository global variablebuiltin/archive.c+2 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

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

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.

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.

Signature · 1 line
gitgitgadget