summaryrefslogtreecommitdiffstats
path: root/builtin/reflog.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-11-25 15:55:30 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-26 02:36:08 +0100
commit6f33d8e255cb2ff738cd28eab22751efb7c2d6ce (patch)
tree5d2830f4bd30852d1ae082a0bccb26652ff7d689 /builtin/reflog.c
parentSync with Git 2.47.1 (diff)
downloadgit-6f33d8e255cb2ff738cd28eab22751efb7c2d6ce.tar.xz
git-6f33d8e255cb2ff738cd28eab22751efb7c2d6ce.zip
builtin: pass repository to sub commands
In 9b1cb5070f (builtin: add a repository parameter for builtin functions, 2024-09-13) the repository was passed down to all builtin commands. This allowed the repository to be passed down to lower layers without depending on the global `the_repository` variable. Continue this work by also passing down the repository parameter from the command to sub-commands. This will help pass down the repository to other subsystems and cleanup usage of global variables like 'the_repository' and 'the_hash_algo'. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/reflog.c')
-rw-r--r--builtin/reflog.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 22df6834f7..5a0c22f2f7 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -234,7 +234,8 @@ static int expire_total_callback(const struct option *opt,
return 0;
}
-static int cmd_reflog_show(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_show(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -253,7 +254,8 @@ static int show_reflog(const char *refname, void *cb_data UNUSED)
return 0;
}
-static int cmd_reflog_list(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -270,7 +272,8 @@ static int cmd_reflog_list(int argc, const char **argv, const char *prefix)
return refs_for_each_reflog(ref_store, show_reflog, NULL);
}
-static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct cmd_reflog_expire_cb cmd = { 0 };
timestamp_t now = time(NULL);
@@ -394,7 +397,8 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
return status;
}
-static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_delete(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i, status = 0;
unsigned int flags = 0;
@@ -424,7 +428,8 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
return status;
}
-static int cmd_reflog_exists(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_exists(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -467,7 +472,7 @@ int cmd_reflog(int argc,
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0 |
PARSE_OPT_KEEP_UNKNOWN_OPT);
if (fn)
- return fn(argc - 1, argv + 1, prefix);
+ return fn(argc - 1, argv + 1, prefix, repository);
else
return cmd_log_reflog(argc, argv, prefix, repository);
}