setup: stop using the_repository in enter_repo()
Stop using `the_repository` in `enter_repo()` and instead accept the repository as a parameter. The injection of `the_repository` is thus bumped one level higher, where callers now pass it in explicitly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
1 parent
920dba4581
commit
ea1d0f886d
7 files changed
+9
-9
No files matched your search
@@ -2643,7 +2643,7 @@ int cmd_receive_pack(int argc,
|
|||||||
|
|
||||||
setup_path();
|
setup_path();
|
||||||
|
|
||||||
if (!enter_repo(service_dir, 0))
|
if (!enter_repo(the_repository, service_dir, 0))
|
||||||
die("'%s' does not appear to be a git repository", service_dir);
|
die("'%s' does not appear to be a git repository", service_dir);
|
||||||
|
|
||||||
repo_config(the_repository, receive_pack_config, NULL);
|
repo_config(the_repository, receive_pack_config, NULL);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ int cmd_upload_archive_writer(int argc,
|
|||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage(upload_archive_usage);
|
usage(upload_archive_usage);
|
||||||
|
|
||||||
if (!enter_repo(argv[1], 0))
|
if (!enter_repo(the_repository, argv[1], 0))
|
||||||
die("'%s' does not appear to be a git repository", argv[1]);
|
die("'%s' does not appear to be a git repository", argv[1]);
|
||||||
|
|
||||||
init_archivers();
|
init_archivers();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ int cmd_upload_pack(int argc,
|
|||||||
|
|
||||||
if (strict)
|
if (strict)
|
||||||
enter_repo_flags |= ENTER_REPO_STRICT;
|
enter_repo_flags |= ENTER_REPO_STRICT;
|
||||||
if (!enter_repo(dir, enter_repo_flags))
|
if (!enter_repo(the_repository, dir, enter_repo_flags))
|
||||||
die("'%s' does not appear to be a git repository", dir);
|
die("'%s' does not appear to be a git repository", dir);
|
||||||
|
|
||||||
switch (determine_protocol_version_server()) {
|
switch (determine_protocol_version_server()) {
|
||||||
|
|||||||
@@ -244,14 +244,14 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
enter_repo_flags = strict_paths ? ENTER_REPO_STRICT : 0;
|
enter_repo_flags = strict_paths ? ENTER_REPO_STRICT : 0;
|
||||||
path = enter_repo(dir, enter_repo_flags);
|
path = enter_repo(the_repository, dir, enter_repo_flags);
|
||||||
if (!path && base_path && base_path_relaxed) {
|
if (!path && base_path && base_path_relaxed) {
|
||||||
/*
|
/*
|
||||||
* if we fail and base_path_relaxed is enabled, try without
|
* if we fail and base_path_relaxed is enabled, try without
|
||||||
* prefixing the base path
|
* prefixing the base path
|
||||||
*/
|
*/
|
||||||
dir = directory;
|
dir = directory;
|
||||||
path = enter_repo(dir, enter_repo_flags);
|
path = enter_repo(the_repository, dir, enter_repo_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
|
|||||||
+1
-1
@@ -809,7 +809,7 @@ int cmd_main(int argc UNUSED, const char **argv UNUSED)
|
|||||||
not_found(&hdr, "Request not supported: '%s'", dir);
|
not_found(&hdr, "Request not supported: '%s'", dir);
|
||||||
|
|
||||||
setup_path();
|
setup_path();
|
||||||
if (!enter_repo(dir, 0))
|
if (!enter_repo(the_repository, dir, 0))
|
||||||
not_found(&hdr, "Not a git repository: '%s'", dir);
|
not_found(&hdr, "Not a git repository: '%s'", dir);
|
||||||
if (!getenv("GIT_HTTP_EXPORT_ALL") &&
|
if (!getenv("GIT_HTTP_EXPORT_ALL") &&
|
||||||
access("git-daemon-export-ok", F_OK) )
|
access("git-daemon-export-ok", F_OK) )
|
||||||
|
|||||||
@@ -1765,7 +1765,7 @@ enum discovery_result discover_git_directory_reason(struct strbuf *commondir,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *enter_repo(const char *path, unsigned flags)
|
const char *enter_repo(struct repository *repo, const char *path, unsigned flags)
|
||||||
{
|
{
|
||||||
static struct strbuf validated_path = STRBUF_INIT;
|
static struct strbuf validated_path = STRBUF_INIT;
|
||||||
static struct strbuf used_path = STRBUF_INIT;
|
static struct strbuf used_path = STRBUF_INIT;
|
||||||
@@ -1838,7 +1838,7 @@ const char *enter_repo(const char *path, unsigned flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_git_directory(".")) {
|
if (is_git_directory(".")) {
|
||||||
set_git_dir(the_repository, ".", 0);
|
set_git_dir(repo, ".", 0);
|
||||||
check_repository_format(NULL);
|
check_repository_format(NULL);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ enum {
|
|||||||
* links. User relative paths are also returned as they are given,
|
* links. User relative paths are also returned as they are given,
|
||||||
* except DWIM suffixing.
|
* except DWIM suffixing.
|
||||||
*/
|
*/
|
||||||
const char *enter_repo(const char *path, unsigned flags);
|
const char *enter_repo(struct repository *repo, const char *path, unsigned flags);
|
||||||
|
|
||||||
const char *setup_git_directory_gently(int *);
|
const char *setup_git_directory_gently(int *);
|
||||||
const char *setup_git_directory(void);
|
const char *setup_git_directory(void);
|
||||||
|
|||||||
Reference in new issue
Block a user