Subject: [PATCH 0/3] Add repository parameter to builtins

From: "John Cai via GitGitGadget" <[email-masked]>
Date: Thu, 05 Sep 2024 16:57:44 +0000

As part of the effort to remove global state of the_repository, add a
repository parameter to builtins so that a repository variable can be passed
down. The patches are ordered as follows:

 1. Changes the signature of builtins and passes the_repository down in
    git.c to be called by all builtins.
 2. Remove USE_THE_REPOSITORY_VARIABLE from builtin.h, and instead add it to
    each individual builtin. This paves the way for a migration process
    whereby each builtin can be migrated away from using the_repository.
 3. As an example, migrate builtin/add.c to get rid of the_repository by
    instead passing the repository argument down into helper functions.

John Cai (3):
  builtin: add a repository parameter for builtin functions
  builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
  add: pass in repo variable instead of global the_repository

 builtin.h                          | 285 ++++++++++++++---------------
 builtin/add.c                      |  99 +++++-----
 builtin/am.c                       |   3 +-
 builtin/annotate.c                 |   4 +-
 builtin/apply.c                    |   3 +-
 builtin/archive.c                  |   3 +-
 builtin/bisect.c                   |   3 +-
 builtin/blame.c                    |   4 +-
 builtin/branch.c                   |   5 +-
 builtin/bugreport.c                |   3 +-
 builtin/bundle.c                   |   3 +-
 builtin/cat-file.c                 |   7 +-
 builtin/check-attr.c               |   3 +-
 builtin/check-ignore.c             |   3 +-
 builtin/check-mailmap.c            |   3 +-
 builtin/check-ref-format.c         |   2 +-
 builtin/checkout--worker.c         |   3 +-
 builtin/checkout-index.c           |   3 +-
 builtin/checkout.c                 |   7 +-
 builtin/clean.c                    |   4 +-
 builtin/clone.c                    |   5 +-
 builtin/column.c                   |   4 +-
 builtin/commit-graph.c             |   3 +-
 builtin/commit-tree.c              |   3 +-
 builtin/commit.c                   |   9 +-
 builtin/config.c                   |   3 +-
 builtin/count-objects.c            |   4 +-
 builtin/credential-cache--daemon.c |   5 +-
 builtin/credential-cache.c         |   2 +-
 builtin/credential-store.c         |   3 +-
 builtin/credential.c               |   4 +-
 builtin/describe.c                 |   5 +-
 builtin/diagnose.c                 |   2 +-
 builtin/diff-files.c               |   3 +-
 builtin/diff-index.c               |   3 +-
 builtin/diff-tree.c                |   3 +-
 builtin/diff.c                     |   5 +-
 builtin/difftool.c                 |   5 +-
 builtin/fast-export.c              |   4 +-
 builtin/fast-import.c              |   3 +-
 builtin/fetch-pack.c               |   3 +-
 builtin/fetch.c                    |   3 +-
 builtin/fmt-merge-msg.c            |   3 +-
 builtin/for-each-ref.c             |   3 +-
 builtin/for-each-repo.c            |   3 +-
 builtin/fsck.c                     |   3 +-
 builtin/fsmonitor--daemon.c        |   5 +-
 builtin/gc.c                       |   6 +-
 builtin/get-tar-commit-id.c        |   2 +-
 builtin/grep.c                     |   3 +-
 builtin/hash-object.c              |   4 +-
 builtin/help.c                     |   4 +-
 builtin/hook.c                     |   3 +-
 builtin/index-pack.c               |   3 +-
 builtin/init-db.c                  |   2 +-
 builtin/interpret-trailers.c       |   4 +-
 builtin/log.c                      |  13 +-
 builtin/ls-files.c                 |   3 +-
 builtin/ls-remote.c                |   3 +-
 builtin/ls-tree.c                  |   4 +-
 builtin/mailinfo.c                 |   2 +-
 builtin/mailsplit.c                |   2 +-
 builtin/merge-base.c               |   3 +-
 builtin/merge-file.c               |   3 +-
 builtin/merge-index.c              |   3 +-
 builtin/merge-ours.c               |   3 +-
 builtin/merge-recursive.c          |   3 +-
 builtin/merge-tree.c               |   3 +-
 builtin/merge.c                    |   9 +-
 builtin/mktag.c                    |   3 +-
 builtin/mktree.c                   |   4 +-
 builtin/multi-pack-index.c         |   3 +-
 builtin/mv.c                       |   3 +-
 builtin/name-rev.c                 |   3 +-
 builtin/notes.c                    |   4 +-
 builtin/pack-objects.c             |   3 +-
 builtin/pack-redundant.c           |   3 +-
 builtin/pack-refs.c                |   3 +-
 builtin/patch-id.c                 |   3 +-
 builtin/prune-packed.c             |   2 +-
 builtin/prune.c                    |   3 +-
 builtin/pull.c                     |   3 +-
 builtin/push.c                     |   3 +-
 builtin/range-diff.c               |   3 +-
 builtin/read-tree.c                |   4 +-
 builtin/rebase.c                   |   5 +-
 builtin/receive-pack.c             |   3 +-
 builtin/reflog.c                   |   7 +-
 builtin/refs.c                     |   3 +-
 builtin/remote-ext.c               |   2 +-
 builtin/remote-fd.c                |   2 +-
 builtin/remote.c                   |   3 +-
 builtin/repack.c                   |   3 +-
 builtin/replace.c                  |   3 +-
 builtin/replay.c                   |   3 +-
 builtin/rerere.c                   |   3 +-
 builtin/reset.c                    |   5 +-
 builtin/rev-list.c                 |   3 +-
 builtin/rev-parse.c                |   5 +-
 builtin/revert.c                   |   5 +-
 builtin/rm.c                       |   4 +-
 builtin/send-pack.c                |   3 +-
 builtin/shortlog.c                 |   3 +-
 builtin/show-branch.c              |   3 +-
 builtin/show-index.c               |   3 +-
 builtin/show-ref.c                 |   3 +-
 builtin/sparse-checkout.c          |   3 +-
 builtin/stash.c                    |   3 +-
 builtin/stripspace.c               |   3 +-
 builtin/submodule--helper.c        |   3 +-
 builtin/symbolic-ref.c             |   3 +-
 builtin/tag.c                      |   5 +-
 builtin/unpack-file.c              |   3 +-
 builtin/unpack-objects.c           |   3 +-
 builtin/update-index.c             |   3 +-
 builtin/update-ref.c               |   3 +-
 builtin/update-server-info.c       |   3 +-
 builtin/upload-archive.c           |   5 +-
 builtin/upload-pack.c              |   2 +-
 builtin/var.c                      |   4 +-
 builtin/verify-commit.c            |   3 +-
 builtin/verify-pack.c              |   3 +-
 builtin/verify-tag.c               |   4 +-
 builtin/worktree.c                 |   3 +-
 builtin/write-tree.c               |   4 +-
 commit.h                           |   3 +-
 git.c                              |  14 +-
 help.c                             |   3 +-
 128 files changed, 477 insertions(+), 366 deletions(-)

base-commit: 4590f2e9412378c61eac95966709c78766d326ba
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1778%2Fjohn-cai%2Fjc%2Fadd-the-repository-to-builtin-signature-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1778/john-cai/jc/add-the-repository-to-builtin-signature-v1
Pull-Request: https://github.com/git/git/pull/1778
-- 
gitgitgadget