From: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>, Jeff King <peff@peff.net>,
John Cai <johncai86@gmail.com>
Subject: [PATCH v3 0/4] Add repository parameter to builtins
Date: Fri, 13 Sep 2024 21:16:13 +0000 [thread overview]
Message-ID: <pull.1778.v3.git.git.1726262177.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1778.v2.git.git.1726001960.gitgitgadget@gmail.com>
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. Remove USE_THE_REPOSITORY_VARIABLE from bulitins that do not use
the_repository.
4. As an example, migrate builtin/add.c to get rid of the_repository by
instead passing the repository argument down into helper functions.
Changes since V2:
* Add USE_THE_REPOSITORY_VARIABLE to all builtins under builtin/ that
contain builtin.h, and subsequently add a patch that removes it from
builtins that do not use the_repository.
* removed random generated file
Changes since V1:
* Removed USE_THE_REPOSITORY_VARIABLE from add.c
* removed changes that conflict with existing topics in seen
* Fixed overly long lines formatting issues
John Cai (4):
builtin: add a repository parameter for builtin functions
builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
builtin: remove USE_THE_REPOSITORY for those without the_repository
add: pass in repo variable instead of global the_repository
builtin.h | 285 ++++++++++++++---------------
builtin/add.c | 119 ++++++------
builtin/am.c | 7 +-
builtin/annotate.c | 9 +-
builtin/apply.c | 7 +-
builtin/archive.c | 7 +-
builtin/bisect.c | 6 +-
builtin/blame.c | 8 +-
builtin/branch.c | 7 +-
builtin/bugreport.c | 6 +-
builtin/bundle.c | 7 +-
builtin/cat-file.c | 9 +-
builtin/check-attr.c | 7 +-
builtin/check-ignore.c | 7 +-
builtin/check-mailmap.c | 6 +-
builtin/check-ref-format.c | 6 +-
builtin/checkout--worker.c | 6 +-
builtin/checkout-index.c | 8 +-
builtin/checkout.c | 16 +-
builtin/clean.c | 8 +-
builtin/clone.c | 8 +-
builtin/column.c | 6 +-
builtin/commit-graph.c | 7 +-
builtin/commit-tree.c | 8 +-
builtin/commit.c | 14 +-
builtin/config.c | 7 +-
builtin/count-objects.c | 8 +-
builtin/credential-cache--daemon.c | 11 +-
builtin/credential-cache.c | 5 +-
builtin/credential-store.c | 6 +-
builtin/credential.c | 7 +-
builtin/describe.c | 8 +-
builtin/diagnose.c | 5 +-
builtin/diff-files.c | 7 +-
builtin/diff-index.c | 7 +-
builtin/diff-tree.c | 7 +-
builtin/diff.c | 7 +-
builtin/difftool.c | 8 +-
builtin/fast-export.c | 6 +-
builtin/fast-import.c | 7 +-
builtin/fetch-pack.c | 6 +-
builtin/fetch.c | 7 +-
builtin/fmt-merge-msg.c | 6 +-
builtin/for-each-ref.c | 6 +-
builtin/for-each-repo.c | 7 +-
builtin/fsck.c | 7 +-
builtin/fsmonitor--daemon.c | 10 +-
builtin/gc.c | 13 +-
builtin/get-tar-commit-id.c | 5 +-
builtin/grep.c | 7 +-
builtin/hash-object.c | 6 +-
builtin/help.c | 7 +-
builtin/hook.c | 6 +-
builtin/index-pack.c | 6 +-
builtin/init-db.c | 7 +-
builtin/interpret-trailers.c | 7 +-
builtin/log.c | 33 +++-
builtin/ls-files.c | 7 +-
builtin/ls-remote.c | 6 +-
builtin/ls-tree.c | 7 +-
builtin/mailinfo.c | 6 +-
builtin/mailsplit.c | 5 +-
builtin/merge-base.c | 7 +-
builtin/merge-file.c | 6 +-
builtin/merge-index.c | 7 +-
builtin/merge-ours.c | 8 +-
builtin/merge-recursive.c | 7 +-
builtin/merge-tree.c | 7 +-
builtin/merge.c | 12 +-
builtin/mktag.c | 6 +-
builtin/mktree.c | 7 +-
builtin/multi-pack-index.c | 7 +-
builtin/mv.c | 8 +-
builtin/name-rev.c | 7 +-
builtin/notes.c | 9 +-
builtin/pack-objects.c | 7 +-
builtin/pack-redundant.c | 10 +-
builtin/pack-refs.c | 7 +-
builtin/patch-id.c | 6 +-
builtin/prune-packed.c | 5 +-
builtin/prune.c | 6 +-
builtin/pull.c | 6 +-
builtin/push.c | 7 +-
builtin/range-diff.c | 8 +-
builtin/read-tree.c | 8 +-
builtin/rebase.c | 8 +-
builtin/receive-pack.c | 8 +-
builtin/reflog.c | 11 +-
builtin/refs.c | 7 +-
builtin/remote-ext.c | 5 +-
builtin/remote-fd.c | 5 +-
builtin/remote.c | 6 +-
builtin/repack.c | 6 +-
builtin/replace.c | 8 +-
builtin/replay.c | 6 +-
builtin/rerere.c | 8 +-
builtin/reset.c | 7 +-
builtin/rev-list.c | 6 +-
builtin/rev-parse.c | 8 +-
builtin/revert.c | 12 +-
builtin/rm.c | 9 +-
builtin/send-pack.c | 6 +-
builtin/shortlog.c | 7 +-
builtin/show-branch.c | 8 +-
builtin/show-index.c | 7 +-
builtin/show-ref.c | 6 +-
builtin/sparse-checkout.c | 7 +-
builtin/stash.c | 6 +-
builtin/stripspace.c | 6 +-
builtin/submodule--helper.c | 8 +-
builtin/symbolic-ref.c | 6 +-
builtin/tag.c | 7 +-
builtin/unpack-file.c | 6 +-
builtin/unpack-objects.c | 6 +-
builtin/update-index.c | 8 +-
builtin/update-ref.c | 7 +-
builtin/update-server-info.c | 6 +-
builtin/upload-archive.c | 12 +-
builtin/upload-pack.c | 5 +-
builtin/var.c | 7 +-
builtin/verify-commit.c | 7 +-
builtin/verify-pack.c | 6 +-
builtin/verify-tag.c | 6 +-
builtin/worktree.c | 7 +-
builtin/write-tree.c | 8 +-
commit.h | 5 +-
git.c | 12 +-
help.c | 3 +-
128 files changed, 903 insertions(+), 437 deletions(-)
base-commit: 57974d46a4d5a079471c4f7eaa5933b1922299e4
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1778%2Fjohn-cai%2Fjc%2Fadd-the-repository-to-builtin-signature-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1778/john-cai/jc/add-the-repository-to-builtin-signature-v3
Pull-Request: https://github.com/git/git/pull/1778
Range-diff vs v2:
1: 9aaf9662544 ! 1: 02a4466ecc9 builtin: add a repository parameter for builtin functions
@@ builtin/fetch-pack.c: static void add_sought_entry(struct ref ***sought, int *nr
+ struct repository *repo UNUSED)
{
int i, ret;
- struct ref *ref = NULL;
+ struct ref *fetched_refs = NULL, *remote_refs = NULL;
## builtin/fetch.c ##
@@ builtin/fetch.c: static int fetch_one(struct remote *remote, int argc, const char **argv,
@@ help.c: void get_version_info(struct strbuf *buf, int show_build_options)
{
struct strbuf buf = STRBUF_INIT;
int build_options = 0;
-
- ## stkOs5Qh (new) ##
- Binary files /dev/null and stkOs5Qh differ
2: 434c8babbb1 ! 2: 7becd3751fc builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
@@ builtin/check-mailmap.c
#include "config.h"
#include "gettext.h"
+ ## builtin/check-ref-format.c ##
+@@
+ /*
+ * GIT - The information manager from hell
+ */
+-
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "refs.h"
+ #include "setup.h"
+
## builtin/checkout--worker.c ##
@@
+#define USE_THE_REPOSITORY_VARIABLE
@@ builtin/credential-cache--daemon.c
#include "abspath.h"
#include "gettext.h"
+ ## builtin/credential-cache.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "credential.h"
+ #include "gettext.h"
+
## builtin/credential-store.c ##
@@
+#define USE_THE_REPOSITORY_VARIABLE
@@ builtin/describe.c
#include "config.h"
#include "environment.h"
+ ## builtin/diagnose.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "abspath.h"
+ #include "gettext.h"
+
## builtin/diff-files.c ##
@@
*
@@ builtin/gc.c
#include "tempfile.h"
#include "lockfile.h"
+ ## builtin/get-tar-commit-id.c ##
+@@
+ /*
+ * Copyright (c) 2005, 2006 Rene Scharfe
+ */
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "commit.h"
+ #include "tar.h"
+
## builtin/grep.c ##
@@
*
@@ builtin/mailinfo.c
#include "abspath.h"
#include "environment.h"
+ ## builtin/mailsplit.c ##
+@@
+ * It just splits a mbox into a list of files: "0001" "0002" ..
+ * so you can process them further from there.
+ */
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "gettext.h"
+ #include "string-list.h"
+
## builtin/merge-base.c ##
@@
+#define USE_THE_REPOSITORY_VARIABLE
@@ builtin/patch-id.c
#include "config.h"
#include "diff.h"
+ ## builtin/prune-packed.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "gettext.h"
+ #include "parse-options.h"
+
## builtin/prune.c ##
@@
+#define USE_THE_REPOSITORY_VARIABLE
@@ builtin/refs.c
#define REFS_MIGRATE_USAGE \
+ ## builtin/remote-ext.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "transport.h"
+ #include "run-command.h"
+
+ ## builtin/remote-fd.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "transport.h"
+
+
## builtin/remote.c ##
@@
+#define USE_THE_REPOSITORY_VARIABLE
@@ builtin/upload-archive.c
#include "strvec.h"
+ ## builtin/upload-pack.c ##
+@@
++#define USE_THE_REPOSITORY_VARIABLE
+ #include "builtin.h"
+ #include "exec-cmd.h"
+ #include "gettext.h"
+
## builtin/var.c ##
@@
*
-: ----------- > 3: 004283a1e5b builtin: remove USE_THE_REPOSITORY for those without the_repository
3: 6956d3fe897 = 4: d32f8ade1e0 add: pass in repo variable instead of global the_repository
--
gitgitgadget
next prev parent reply other threads:[~2024-09-13 21:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 16:57 [PATCH 0/3] Add repository parameter to builtins John Cai via GitGitGadget
2024-09-05 16:57 ` [PATCH 1/3] builtin: add a repository parameter for builtin functions John Cai via GitGitGadget
2024-09-06 10:46 ` Patrick Steinhardt
2024-09-09 21:08 ` John Cai
2024-09-05 16:57 ` [PATCH 2/3] builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h John Cai via GitGitGadget
2024-09-05 17:50 ` Junio C Hamano
2024-09-06 10:46 ` Patrick Steinhardt
2024-09-06 15:43 ` Junio C Hamano
2024-09-05 16:57 ` [PATCH 3/3] add: pass in repo variable instead of global the_repository John Cai via GitGitGadget
2024-09-06 10:46 ` Patrick Steinhardt
2024-09-05 17:21 ` [PATCH 0/3] Add repository parameter to builtins Junio C Hamano
2024-09-10 20:59 ` [PATCH v2 " John Cai via GitGitGadget
2024-09-10 20:59 ` [PATCH v2 1/3] builtin: add a repository parameter for builtin functions John Cai via GitGitGadget
2024-09-10 21:40 ` Junio C Hamano
2024-09-11 21:08 ` Junio C Hamano
2024-09-12 9:45 ` Patrick Steinhardt
2024-09-12 10:43 ` Jeff King
2024-09-12 10:50 ` Jeff King
2024-09-12 10:55 ` Patrick Steinhardt
2024-09-13 17:54 ` John Cai
2024-09-10 20:59 ` [PATCH v2 2/3] builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h John Cai via GitGitGadget
2024-09-11 18:15 ` Junio C Hamano
2024-09-13 18:00 ` John Cai
2024-09-10 20:59 ` [PATCH v2 3/3] add: pass in repo variable instead of global the_repository John Cai via GitGitGadget
2024-09-11 18:23 ` Junio C Hamano
2024-09-13 21:16 ` John Cai via GitGitGadget [this message]
2024-09-13 21:16 ` [PATCH v3 1/4] builtin: add a repository parameter for builtin functions John Cai via GitGitGadget
2024-09-13 21:16 ` [PATCH v3 2/4] builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h John Cai via GitGitGadget
2024-09-13 21:32 ` Junio C Hamano
2024-09-13 21:16 ` [PATCH v3 3/4] builtin: remove USE_THE_REPOSITORY for those without the_repository John Cai via GitGitGadget
2024-09-13 21:16 ` [PATCH v3 4/4] add: pass in repo variable instead of global the_repository John Cai via GitGitGadget
2024-09-13 21:35 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1778.v3.git.git.1726262177.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=johncai86@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.