summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-05-16 08:45:45 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-16 08:46:59 (UTC)
commitc1ad6cb77889880ad0189a689840fbfa6e5cbc80 (patch) (side-by-side diff)
tree352c32898316a388b582385a5fb3c6c534eaa30a
parentf4f1339fe62fb1a28c147567195a86dd99485e25 (diff)
downloadcgit-c1ad6cb77889880ad0189a689840fbfa6e5cbc80.zip
cgit-c1ad6cb77889880ad0189a689840fbfa6e5cbc80.tar.gz
cgit-c1ad6cb77889880ad0189a689840fbfa6e5cbc80.tar.bz2
Restrict length of repo description on repolist page
If any repo has a very long description, all repos suffer since the repo-links in the right-most column gets pushed out of sight. Fix it by introducing max-repodesc-length parameter in cgitrc, and default to 60 chars. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
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
@@ -80,24 +80,25 @@ 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;
diff --git a/cgitrc b/cgitrc
index e7e731c..f923cc4 100644
--- a/cgitrc
+++ b/cgitrc
@@ -42,24 +42,28 @@
## 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
diff --git a/shared.c b/shared.c
index a1e1acd..752ceac 100644
--- a/shared.c
+++ b/shared.c
@@ -21,24 +21,25 @@ 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;
@@ -109,24 +110,26 @@ void cgit_global_config_cb(const char *name, const char *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);
diff --git a/ui-repolist.c b/ui-repolist.c
index d341193..d7311e4 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -21,25 +21,25 @@ void cgit_print_repolist(struct cacheitem *item)
"<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> ");