summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
-rw-r--r--cgitrc4
-rw-r--r--shared.c3
-rw-r--r--ui-repolist.c2
4 files changed, 9 insertions, 1 deletions
diff --git a/cgit.h b/cgit.h
index 764225d..290401f 100644
--- a/cgit.h
+++ b/cgit.h
@@ -68,48 +68,49 @@ struct taginfo {
extern const char cgit_version[];
extern struct repolist cgit_repolist;
extern struct repoinfo *cgit_repo;
extern char *cgit_root_title;
extern char *cgit_css;
extern char *cgit_logo;
extern char *cgit_logo_link;
extern char *cgit_module_link;
extern char *cgit_virtual_root;
extern char *cgit_script_name;
extern char *cgit_cache_root;
extern int cgit_nocache;
extern int cgit_snapshots;
extern int cgit_max_lock_attempts;
extern int cgit_cache_root_ttl;
extern int cgit_cache_repo_ttl;
extern int cgit_cache_dynamic_ttl;
extern int cgit_cache_static_ttl;
extern int cgit_cache_max_create_time;
extern int cgit_max_msg_len;
+extern int cgit_max_repodesc_len;
extern int cgit_max_commit_count;
extern char *cgit_repo_name;
extern char *cgit_repo_desc;
extern char *cgit_repo_owner;
extern int cgit_query_has_symref;
extern int cgit_query_has_sha1;
extern char *cgit_querystring;
extern char *cgit_query_repo;
extern char *cgit_query_page;
extern char *cgit_query_search;
extern char *cgit_query_head;
extern char *cgit_query_sha1;
extern char *cgit_query_sha2;
extern char *cgit_query_path;
extern char *cgit_query_name;
extern int cgit_query_ofs;
extern int htmlfd;
extern void cgit_global_config_cb(const char *name, const char *value);
extern void cgit_repo_config_cb(const char *name, const char *value);
diff --git a/cgitrc b/cgitrc
index e7e731c..f923cc4 100644
--- a/cgitrc
+++ b/cgitrc
@@ -30,48 +30,52 @@
## This setting is disabled by default.
#virtual-root=/git
## Set the title printed on the root page
#root-title=Git repository browser
## Link to css file
#css=/cgit/cgit.css
## Link to logo file
#logo=/cgit/git-logo.png
## Url loaded when clicking the logo
#logo-link=http://www.kernel.org/pub/software/scm/git/docs/
## Url loaded when clicking a submodule link
#module-link=./?repo=%s&page=commit&id=%s
+## Number of chars shown of repo description (in repolist view)
+#max-repodesc-length=60
+
+
## Number of chars shown of commit subject message (in log view)
#max-message-length=60
## Number of commits per page in log view
#max-commit-count=50
## Root of cached output
#cache-root=/var/cache/cgit
## Include another config-file
#include=/var/cgit/repolist
##
## Time-To-Live settings: specifies how long (in minutes) different pages
## should be cached (0 for instant expiration, -1 for immortal pages)
##
## ttl for root page
#cache-root-ttl=5
## ttl for repo summary page
diff --git a/shared.c b/shared.c
index a1e1acd..752ceac 100644
--- a/shared.c
+++ b/shared.c
@@ -9,48 +9,49 @@
#include "cgit.h"
struct repolist cgit_repolist;
struct repoinfo *cgit_repo;
char *cgit_root_title = "Git repository browser";
char *cgit_css = "/cgit.css";
char *cgit_logo = "/git-logo.png";
char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
char *cgit_module_link = "./?repo=%s&page=commit&id=%s";
char *cgit_virtual_root = NULL;
char *cgit_script_name = CGIT_SCRIPT_NAME;
char *cgit_cache_root = "/var/cache/cgit";
int cgit_nocache = 0;
int cgit_snapshots = 0;
int cgit_max_lock_attempts = 5;
int cgit_cache_root_ttl = 5;
int cgit_cache_repo_ttl = 5;
int cgit_cache_dynamic_ttl = 5;
int cgit_cache_static_ttl = -1;
int cgit_cache_max_create_time = 5;
int cgit_max_msg_len = 60;
+int cgit_max_repodesc_len = 60;
int cgit_max_commit_count = 50;
int cgit_query_has_symref = 0;
int cgit_query_has_sha1 = 0;
char *cgit_querystring = NULL;
char *cgit_query_repo = NULL;
char *cgit_query_page = NULL;
char *cgit_query_head = NULL;
char *cgit_query_search = NULL;
char *cgit_query_sha1 = NULL;
char *cgit_query_sha2 = NULL;
char *cgit_query_path = NULL;
char *cgit_query_name = NULL;
int cgit_query_ofs = 0;
int htmlfd = 0;
int chk_zero(int result, char *msg)
{
if (result != 0)
die("%s: %s", msg, strerror(errno));
return result;
}
@@ -97,48 +98,50 @@ void cgit_global_config_cb(const char *name, const char *value)
else if (!strcmp(name, "logo"))
cgit_logo = xstrdup(value);
else if (!strcmp(name, "logo-link"))
cgit_logo_link = xstrdup(value);
else if (!strcmp(name, "module-link"))
cgit_module_link = xstrdup(value);
else if (!strcmp(name, "virtual-root"))
cgit_virtual_root = xstrdup(value);
else if (!strcmp(name, "nocache"))
cgit_nocache = atoi(value);
else if (!strcmp(name, "snapshots"))
cgit_snapshots = atoi(value);
else if (!strcmp(name, "cache-root"))
cgit_cache_root = xstrdup(value);
else if (!strcmp(name, "cache-root-ttl"))
cgit_cache_root_ttl = atoi(value);
else if (!strcmp(name, "cache-repo-ttl"))
cgit_cache_repo_ttl = atoi(value);
else if (!strcmp(name, "cache-static-ttl"))
cgit_cache_static_ttl = atoi(value);
else if (!strcmp(name, "cache-dynamic-ttl"))
cgit_cache_dynamic_ttl = atoi(value);
else if (!strcmp(name, "max-message-length"))
cgit_max_msg_len = atoi(value);
+ else if (!strcmp(name, "max-repodesc-length"))
+ cgit_max_repodesc_len = atoi(value);
else if (!strcmp(name, "max-commit-count"))
cgit_max_commit_count = atoi(value);
else if (!strcmp(name, "repo.url"))
cgit_repo = add_repo(value);
else if (!strcmp(name, "repo.name"))
cgit_repo->name = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.path"))
cgit_repo->path = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.desc"))
cgit_repo->desc = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.owner"))
cgit_repo->owner = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.defbranch"))
cgit_repo->defbranch = xstrdup(value);
else if (cgit_repo && !strcmp(name, "repo.snapshots"))
cgit_repo->snapshots = atoi(value);
else if (cgit_repo && !strcmp(name, "repo.module-link"))
cgit_repo->module_link= xstrdup(value);
else if (!strcmp(name, "include"))
cgit_read_config(value, cgit_global_config_cb);
}
void cgit_querystring_cb(const char *name, const char *value)
{
diff --git a/ui-repolist.c b/ui-repolist.c
index d341193..d7311e4 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -9,45 +9,45 @@
#include "cgit.h"
void cgit_print_repolist(struct cacheitem *item)
{
struct repoinfo *repo;
int i;
cgit_print_docstart(cgit_root_title, item);
cgit_print_pageheader(cgit_root_title, 0);
html("<table class='list nowrap'>");
html("<tr class='nohover'>"
"<th class='left'>Name</th>"
"<th class='left'>Description</th>"
"<th class='left'>Owner</th>"
"<th class='left'>Links</th></tr>\n");
for (i=0; i<cgit_repolist.count; i++) {
repo = &cgit_repolist.repos[i];
html("<tr><td>");
html_link_open(cgit_repourl(repo->url), NULL, NULL);
html_txt(repo->name);
html_link_close();
html("</td><td>");
- html_txt(repo->desc);
+ html_ntxt(cgit_max_repodesc_len, repo->desc);
html("</td><td>");
html_txt(repo->owner);
html("</td><td>");
html_link_open(cgit_pageurl(repo->name, "commit", NULL),
"Commit: display last commit", NULL);
html("C</a> ");
html_link_open(cgit_pageurl(repo->name, "diff", NULL),
"Diff: see changes introduced by last commit", NULL);
html("D</a> ");
html_link_open(cgit_pageurl(repo->name, "log", NULL),
"Log: show history of the main branch", NULL);
html("L</a> ");
html_link_open(cgit_pageurl(repo->name, "tree", NULL),
"Tree: browse the files in the main branch", NULL);
html("T</a>");
html("</td></tr>\n");
}
html("</table>");
cgit_print_docend();
}