archive: remove the_repository global variable
As part of the effort to get rid of global state due to the global the_repository variable, replace the_repository with the repository argument that gets passed down through the builtin function. The repo might be NULL, but we should be safe in write_archive() because it detects if we are outside of a repository and calls setup_git_directory() which will error. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) 2006 Franck Bui-Huu
|
* Copyright (c) 2006 Franck Bui-Huu
|
||||||
* Copyright (c) 2006 Rene Scharfe
|
* Copyright (c) 2006 Rene Scharfe
|
||||||
*/
|
*/
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "archive.h"
|
#include "archive.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -79,7 +78,7 @@ static int run_remote_archiver(int argc, const char **argv,
|
|||||||
int cmd_archive(int argc,
|
int cmd_archive(int argc,
|
||||||
const char **argv,
|
const char **argv,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct repository *repo UNUSED)
|
struct repository *repo)
|
||||||
{
|
{
|
||||||
const char *exec = "git-upload-archive";
|
const char *exec = "git-upload-archive";
|
||||||
char *output = NULL;
|
char *output = NULL;
|
||||||
@ -110,7 +109,7 @@ int cmd_archive(int argc,
|
|||||||
|
|
||||||
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
||||||
|
|
||||||
ret = write_archive(argc, argv, prefix, the_repository, output, 0);
|
ret = write_archive(argc, argv, prefix, repo, output, 0);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(output);
|
free(output);
|
||||||
|
Reference in New Issue
Block a user