Este commit está contenido en:
Lars Hjemli 2009-12-08 18:31:07 +01:00
commit 57bb4fdb84
Se han modificado 6 ficheros con 31 adiciones y 17 borrados

3
cgit.c
Ver fichero

@ -165,6 +165,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.max_msg_len = atoi(value); ctx.cfg.max_msg_len = atoi(value);
else if (!strcmp(name, "max-repodesc-length")) else if (!strcmp(name, "max-repodesc-length"))
ctx.cfg.max_repodesc_len = atoi(value); ctx.cfg.max_repodesc_len = atoi(value);
else if (!strcmp(name, "max-blob-size"))
ctx.cfg.max_blob_size = atoi(value);
else if (!strcmp(name, "max-repo-count")) else if (!strcmp(name, "max-repo-count"))
ctx.cfg.max_repo_count = atoi(value); ctx.cfg.max_repo_count = atoi(value);
else if (!strcmp(name, "max-commit-count")) else if (!strcmp(name, "max-commit-count"))
@ -270,6 +272,7 @@ static void prepare_context(struct cgit_context *ctx)
ctx->cfg.max_lock_attempts = 5; ctx->cfg.max_lock_attempts = 5;
ctx->cfg.max_msg_len = 80; ctx->cfg.max_msg_len = 80;
ctx->cfg.max_repodesc_len = 80; ctx->cfg.max_repodesc_len = 80;
ctx->cfg.max_blob_size = 0;
ctx->cfg.max_stats = 0; ctx->cfg.max_stats = 0;
ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
ctx->cfg.renamelimit = -1; ctx->cfg.renamelimit = -1;

Ver fichero

@ -162,6 +162,11 @@ table.list td a {
color: black; color: black;
} }
table.list td a.ls-dir {
font-weight: bold;
color: #00f;
}
table.list td a:hover { table.list td a:hover {
color: #00f; color: #00f;
} }

1
cgit.h
Ver fichero

@ -185,6 +185,7 @@ struct cgit_config {
int max_lock_attempts; int max_lock_attempts;
int max_msg_len; int max_msg_len;
int max_repodesc_len; int max_repodesc_len;
int max_blob_size;
int max_stats; int max_stats;
int nocache; int nocache;
int noplainemail; int noplainemail;

Ver fichero

@ -177,6 +177,10 @@ max-repodesc-length::
Specifies the maximum number of repo description characters to display Specifies the maximum number of repo description characters to display
on the repository index page. Default value: "80". on the repository index page. Default value: "80".
max-blob-size::
Specifies the maximum size of a blob to display HTML for in KBytes.
Default value: "0" (limit disabled).
max-stats:: max-stats::
Set the default maximum statistics period. Valid values are "week", Set the default maximum statistics period. Valid values are "week",
"month", "quarter" and "year". If unspecified, statistics are "month", "quarter" and "year". If unspecified, statistics are

Ver fichero

@ -3,6 +3,10 @@
# tree-view by refering to this file with the source-filter or repo.source- # tree-view by refering to this file with the source-filter or repo.source-
# filter options in cgitrc. # filter options in cgitrc.
# #
# This script requires a shell supporting the ${var##pattern} syntax.
# It is supported by at least dash and bash, however busybox environments
# might have to use an external call to sed instead.
#
# Note: the highlight command (http://www.andre-simon.de/) uses css for syntax # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax
# highlighting, so you'll probably want something like the following included # highlighting, so you'll probably want something like the following included
# in your css file (generated by highlight 2.4.8 and adapted for cgit): # in your css file (generated by highlight 2.4.8 and adapted for cgit):
@ -20,20 +24,11 @@
# table.blob .kwc { color:#000000; font-weight:bold; } # table.blob .kwc { color:#000000; font-weight:bold; }
# table.blob .kwd { color:#010181; } # table.blob .kwd { color:#010181; }
case "$1" in # store filename and extension in local vars
*.c) BASENAME="$1"
highlight -f -I -X -S c EXTENSION="${BASENAME##*.}"
;;
*.h) # map Makefile and Makefile.* to .mk
highlight -f -I -X -S c [ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk
;;
*.sh) exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null
highlight -f -I -X -S sh
;;
*.css)
highlight -f -I -X -S css
;;
*)
highlight -f -I -X -S txt
;;
esac

Ver fichero

@ -107,6 +107,12 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
curr_rev, path); curr_rev, path);
htmlf(")<br/>blob: %s\n", sha1_to_hex(sha1)); htmlf(")<br/>blob: %s\n", sha1_to_hex(sha1));
if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
htmlf("<div class='error'>blob size (%dKB) exceeds display size limit (%dKB).</div>",
size / 1024, ctx.cfg.max_blob_size);
return;
}
if (buffer_is_binary(buf, size)) if (buffer_is_binary(buf, size))
print_binary_buffer(buf, size); print_binary_buffer(buf, size);
else else