builtin: add a repository parameter for builtin functions
In order to reduce the usage of the global the_repository, add a parameter to builtin functions that will get passed a repository variable. This commit uses UNUSED on most of the builtin functions, as subsequent commits will modify the actual builtins to pass the repository parameter down. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -167,7 +167,10 @@ int interactive_add(const char **argv, const char *prefix, int patch)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int edit_patch(int argc, const char **argv, const char *prefix)
|
||||
static int edit_patch(int argc,
|
||||
const char **argv,
|
||||
const char *prefix,
|
||||
struct repository *repo UNUSED)
|
||||
{
|
||||
char *file = git_pathdup("ADD_EDIT.patch");
|
||||
struct child_process child = CHILD_PROCESS_INIT;
|
||||
@ -358,7 +361,10 @@ static int add_files(struct dir_struct *dir, int flags)
|
||||
return exit_status;
|
||||
}
|
||||
|
||||
int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
int cmd_add(int argc,
|
||||
const char **argv,
|
||||
const char *prefix,
|
||||
struct repository *repo UNUSED)
|
||||
{
|
||||
int exit_status = 0;
|
||||
struct pathspec pathspec;
|
||||
@ -387,7 +393,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
if (edit_interactive) {
|
||||
if (pathspec_from_file)
|
||||
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--edit");
|
||||
return(edit_patch(argc, argv, prefix));
|
||||
return(edit_patch(argc, argv, prefix, the_repository));
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
Reference in New Issue
Block a user