author | Lars Hjemli <hjemli@gmail.com> | 2007-01-28 11:17:03 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-01-28 11:17:03 (UTC) |
commit | 7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5 (patch) (side-by-side diff) | |
tree | 17f0e21c129723468a1f291faba52580993a39b1 | |
parent | d8b0cca2606f8919208ea68549ff60c6e5fe91bb (diff) | |
download | cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.zip cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.tar.gz cgit-7dd50c98d73bf6c579b8ce5893739a2d0ffc00d5.tar.bz2 |
Add parameter to adjust max message length in log listings
The parameter "max-message-length" can be specified in cgitrc, default value
is 60.
This affects the log message shown in repo summary and shortlog.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | shared.c | 4 | ||||
-rw-r--r-- | ui-log.c | 2 | ||||
-rw-r--r-- | ui-summary.c | 2 |
4 files changed, 8 insertions, 2 deletions
@@ -31,48 +31,50 @@ struct taginfo { char *tagger; char *tagger_email; int tagger_date; char *msg; }; extern const char cgit_version[]; extern char *cgit_root; extern char *cgit_root_title; extern char *cgit_css; extern char *cgit_logo; extern char *cgit_logo_link; extern char *cgit_virtual_root; extern char *cgit_cache_root; extern int cgit_nocache; 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 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 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); extern void cgit_querystring_cb(const char *name, const char *value); extern int hextoint(char c); @@ -4,93 +4,97 @@ * * Licensed under GNU General Public License v2 * (see COPYING for full license text) */ #include "cgit.h" char *cgit_root = "/usr/src/git"; 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_virtual_root = NULL; char *cgit_cache_root = "/var/cache/cgit"; int cgit_nocache = 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; + char *cgit_repo_name = NULL; char *cgit_repo_desc = NULL; char *cgit_repo_owner = NULL; 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; int cgit_query_ofs = 0; int htmlfd = 0; void cgit_global_config_cb(const char *name, const char *value) { if (!strcmp(name, "root")) cgit_root = xstrdup(value); else if (!strcmp(name, "root-title")) cgit_root_title = xstrdup(value); else if (!strcmp(name, "css")) cgit_css = xstrdup(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, "virtual-root")) cgit_virtual_root = xstrdup(value); else if (!strcmp(name, "nocache")) cgit_nocache = 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); } void cgit_repo_config_cb(const char *name, const char *value) { if (!strcmp(name, "name")) cgit_repo_name = xstrdup(value); else if (!strcmp(name, "desc")) cgit_repo_desc = xstrdup(value); else if (!strcmp(name, "owner")) cgit_repo_owner = xstrdup(value); } void cgit_querystring_cb(const char *name, const char *value) { if (!strcmp(name,"r")) { cgit_query_repo = xstrdup(value); } else if (!strcmp(name, "p")) { cgit_query_page = xstrdup(value); } else if (!strcmp(name, "q")) { cgit_query_search = xstrdup(value); } else if (!strcmp(name, "h")) { cgit_query_head = xstrdup(value); cgit_query_has_symref = 1; } else if (!strcmp(name, "id")) { @@ -2,49 +2,49 @@ * * Copyright (C) 2006 Lars Hjemli * * Licensed under GNU General Public License v2 * (see COPYING for full license text) */ #include "cgit.h" void print_commit(struct commit *commit) { char buf[32]; struct commitinfo *info; struct tm *time; info = cgit_parse_commit(commit); time = gmtime(&commit->date); html("<tr><td>"); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); html_txt(buf); html("</td><td>"); char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); char *url = cgit_pageurl(cgit_query_repo, "commit", qry); html_link_open(url, NULL, NULL); - html_ntxt(80, info->subject); + html_ntxt(cgit_max_msg_len, info->subject); html_link_close(); html("</td><td>"); html_txt(info->author); html("</td></tr>\n"); cgit_free_commitinfo(info); } void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) { struct rev_info rev; struct commit *commit; const char *argv[3] = {NULL, tip, NULL}; int argc = 2; int i; if (grep) argv[argc++] = fmt("--grep=%s", grep); init_revisions(&rev, NULL); rev.abbrev = DEFAULT_ABBREV; rev.commit_format = CMIT_FMT_DEFAULT; rev.verbose_header = 1; rev.show_root_diff = 0; setup_revisions(argc, argv, &rev, NULL); diff --git a/ui-summary.c b/ui-summary.c index 04d4912..5518d01 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -12,49 +12,49 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, int flags, void *cb_data) { struct commit *commit; struct commitinfo *info; char buf[256], *url; strncpy(buf, refname, sizeof(buf)); commit = lookup_commit(sha1); if (commit && !parse_commit(commit)){ info = cgit_parse_commit(commit); html("<tr><td>"); url = cgit_pageurl(cgit_query_repo, "log", fmt("h=%s", refname)); html_link_open(url, NULL, NULL); html_txt(buf); html_link_close(); html("</td><td>"); cgit_print_date(commit->date); html("</td><td>"); html_txt(info->author); html("</td><td>"); url = cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(sha1))); html_link_open(url, NULL, NULL); - html_ntxt(80, info->subject); + html_ntxt(cgit_max_msg_len, info->subject); html_link_close(); html("</td></tr>\n"); cgit_free_commitinfo(info); } else { html("<tr><td>"); html_txt(buf); html("</td><td colspan='3'>"); htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); html("</td></tr>\n"); } return 0; } static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, int flags, void *cb_data) { struct tag *tag; struct taginfo *info; char buf[256], *page, *url; strncpy(buf, refname, sizeof(buf)); tag = lookup_tag(sha1); if (tag && !parse_tag(tag) && (info = cgit_parse_tag(tag))){ html("<tr><td>"); |