Merge branch 'jc/pass-repo-to-builtins'

The convention to calling into built-in command implementation has
been updated to pass the repository, if known, together with the
prefix value.

* jc/pass-repo-to-builtins:
  add: pass in repo variable instead of global the_repository
  builtin: remove USE_THE_REPOSITORY for those without the_repository
  builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
  builtin: add a repository parameter for builtin functions
This commit is contained in:
Junio C Hamano
2024-09-23 10:35:09 -07:00
128 changed files with 903 additions and 437 deletions

View File

@ -4,6 +4,7 @@
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
@ -37,7 +38,7 @@
#include "mailmap.h"
#include "progress.h"
#include "commit-slab.h"
#include "repository.h"
#include "commit-reach.h"
#include "range-diff.h"
#include "tmp-objdir.h"
@ -627,7 +628,10 @@ static int git_log_config(const char *var, const char *value,
return git_diff_ui_config(var, value, ctx, cb);
}
int cmd_whatchanged(int argc, const char **argv, const char *prefix)
int cmd_whatchanged(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct log_config cfg;
struct rev_info rev;
@ -748,7 +752,10 @@ static void show_setup_revisions_tweak(struct rev_info *rev)
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
}
int cmd_show(int argc, const char **argv, const char *prefix)
int cmd_show(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct log_config cfg;
struct rev_info rev;
@ -864,7 +871,10 @@ int cmd_show(int argc, const char **argv, const char *prefix)
/*
* This is equivalent to "git log -g --abbrev-commit --pretty=oneline"
*/
int cmd_log_reflog(int argc, const char **argv, const char *prefix)
int cmd_log_reflog(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct log_config cfg;
struct rev_info rev;
@ -906,7 +916,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev)
diff_merges_default_to_first_parent(rev);
}
int cmd_log(int argc, const char **argv, const char *prefix)
int cmd_log(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct log_config cfg;
struct rev_info rev;
@ -1976,7 +1989,10 @@ static void infer_range_diff_ranges(struct strbuf *r1,
}
}
int cmd_format_patch(int argc, const char **argv, const char *prefix)
int cmd_format_patch(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct format_config cfg;
struct commit *commit;
@ -2609,7 +2625,10 @@ static void print_commit(char sign, struct commit *commit, int verbose,
}
}
int cmd_cherry(int argc, const char **argv, const char *prefix)
int cmd_cherry(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
struct rev_info revs;
struct patch_ids ids;