all repos — cgit @ 42231328d3fa1e443566a5d8e6c3ccbce16157b6

a hyperfast web frontend for git written in c

Allow disabling of HTTP clone URLs

If advertising other URLs to your users, you may not want to make this
available through cgit (e.g. if you have the smart HTTP transport set up
elsewhere). Allow disabling the three magic commands that simulate the
git server, but default it to enabled.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Dan McGee dpmcgee@gmail.com
Wed, 12 Jan 2011 12:06:07 -0600
commit

42231328d3fa1e443566a5d8e6c3ccbce16157b6

parent

35d33014fb897cac24f2ae42d8a2d9e005938bd9

3 files changed, 14 insertions(+), 0 deletions(-)

jump to
M cgit.ccgit.c

@@ -139,6 +139,8 @@ else if (!strcmp(name, "enable-filter-overrides"))

ctx.cfg.enable_filter_overrides = atoi(value); else if (!strcmp(name, "enable-gitweb-owner")) ctx.cfg.enable_gitweb_owner = atoi(value); + else if (!strcmp(name, "enable-http-clone")) + ctx.cfg.enable_http_clone = atoi(value); else if (!strcmp(name, "enable-index-links")) ctx.cfg.enable_index_links = atoi(value); else if (!strcmp(name, "enable-log-filecount"))

@@ -300,6 +302,7 @@ ctx->cfg.css = "/cgit.css";

ctx->cfg.logo = "/cgit.png"; ctx->cfg.local_time = 0; ctx->cfg.enable_gitweb_owner = 1; + ctx->cfg.enable_http_clone = 1; ctx->cfg.enable_tree_linenumbers = 1; ctx->cfg.max_repo_count = 50; ctx->cfg.max_commit_count = 50;

@@ -450,6 +453,11 @@ cgit_print_docstart(ctx);

cgit_print_pageheader(ctx); cgit_print_error("Invalid request"); cgit_print_docend(); + return; + } + + if (!ctx->cfg.enable_http_clone && cmd->is_clone) { + html_status(404, "Not found", 0); return; }
M cgit.hcgit.h

@@ -187,6 +187,7 @@ int cache_static_ttl;

int embedded; int enable_filter_overrides; int enable_gitweb_owner; + int enable_http_clone; int enable_index_links; int enable_log_filecount; int enable_log_linecount;
M cgitrc.5.txtcgitrc.5.txt

@@ -100,6 +100,11 @@ If set to "1" and scan-path is enabled, we first check each repository

for the git config value "gitweb.owner" to determine the owner. Default value: "1". See also: scan-path. +enable-http-clone:: + If set to "1", cgit will act as an dumb HTTP endpoint for git clones. + If you use an alternate way of serving git repositories, you may wish + to disable this. Default value: "1". + enable-index-links:: Flag which, when set to "1", will make cgit generate extra links for each repo in the repository index (specifically, to the "summary",