From 8b2bd7cdacf71260dbc954316af2bed8e076c182 Mon Sep 17 00:00:00 2001 From: Tarmigan Casebolt Date: Mon, 28 Dec 2009 16:49:00 -0500 Subject: Smart-http: check if repository is OK to export before serving it Similar to how git-daemon checks whether a repository is OK to be exported, smart-http should also check. This check can be satisfied in two different ways: the environmental variable GIT_HTTP_EXPORT_ALL may be set to export all repositories, or the individual repository may have the file git-daemon-export-ok. Acked-by: Shawn O. Pearce Signed-off-by: Tarmigan Casebolt Signed-off-by: Junio C Hamano --- http-backend.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'http-backend.c') diff --git a/http-backend.c b/http-backend.c index f729488fc5..345c12b790 100644 --- a/http-backend.c +++ b/http-backend.c @@ -648,6 +648,9 @@ int main(int argc, char **argv) setup_path(); if (!enter_repo(dir, 0)) not_found("Not a git repository: '%s'", dir); + if (!getenv("GIT_HTTP_EXPORT_ALL") && + access("git-daemon-export-ok", F_OK) ) + not_found("Repository not exported: '%s'", dir); git_config(http_config, NULL); cmd->imp(cmd_arg); -- cgit v1.2.1