Git fork

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>

authored by

John Cai and committed by
Junio C Hamano
528d3e4d ebe8f4b6

+2 -3
+2 -3
builtin/archive.c
··· 2 2 * Copyright (c) 2006 Franck Bui-Huu 3 3 * Copyright (c) 2006 Rene Scharfe 4 4 */ 5 - #define USE_THE_REPOSITORY_VARIABLE 6 5 #include "builtin.h" 7 6 #include "archive.h" 8 7 #include "gettext.h" ··· 79 78 int cmd_archive(int argc, 80 79 const char **argv, 81 80 const char *prefix, 82 - struct repository *repo UNUSED) 81 + struct repository *repo) 83 82 { 84 83 const char *exec = "git-upload-archive"; 85 84 char *output = NULL; ··· 110 109 111 110 setvbuf(stderr, NULL, _IOLBF, BUFSIZ); 112 111 113 - ret = write_archive(argc, argv, prefix, the_repository, output, 0); 112 + ret = write_archive(argc, argv, prefix, repo, output, 0); 114 113 115 114 out: 116 115 free(output);