add: pass in repo variable instead of global the_repository

With the repository variable available in the builtin function as an
argument, pass this down into helper functions instead of using the
global the_repository.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
John Cai
2024-09-13 21:16:17 +00:00
committed by Junio C Hamano
parent 49d2434664
commit 836474560b
3 changed files with 68 additions and 55 deletions

View File

@ -395,7 +395,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT));
setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1);
if (interactive_add(argv, prefix, patch_interactive) != 0)
if (interactive_add(the_repository, argv, prefix, patch_interactive) != 0)
die(_("interactive add failed"));
the_repository->index_file = old_repo_index_file;