author | Lars Hjemli <hjemli@gmail.com> | 2006-12-21 23:58:18 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-21 23:58:18 (UTC) |
commit | 9d8d9b61238df3a855504825e5f735d00289f12b (patch) (unidiff) | |
tree | ee4e5b6712abb684b920f1f69683eb2b43c6fd8d /ui-log.c | |
parent | 378cae639849ba9f020666d1cf6dad6e08bfaf0e (diff) | |
download | cgit-9d8d9b61238df3a855504825e5f735d00289f12b.zip cgit-9d8d9b61238df3a855504825e5f735d00289f12b.tar.gz cgit-9d8d9b61238df3a855504825e5f735d00289f12b.tar.bz2 |
Only show first 80 characters of commit subject in log and summary
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-log.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,91 +1,91 @@ | |||
1 | /* ui-log.c: functions for log output | 1 | /* ui-log.c: functions for log output |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | void print_commit(struct commit *commit) | 11 | void print_commit(struct commit *commit) |
12 | { | 12 | { |
13 | char buf[32]; | 13 | char buf[32]; |
14 | struct commitinfo *info; | 14 | struct commitinfo *info; |
15 | struct tm *time; | 15 | struct tm *time; |
16 | 16 | ||
17 | info = cgit_parse_commit(commit); | 17 | info = cgit_parse_commit(commit); |
18 | time = gmtime(&commit->date); | 18 | time = gmtime(&commit->date); |
19 | html("<tr><td>"); | 19 | html("<tr><td>"); |
20 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); | 20 | strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); |
21 | html_txt(buf); | 21 | html_txt(buf); |
22 | html("</td><td>"); | 22 | html("</td><td>"); |
23 | char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); | 23 | char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); | 24 | char *url = cgit_pageurl(cgit_query_repo, "commit", qry); |
25 | html_link_open(url, NULL, NULL); | 25 | html_link_open(url, NULL, NULL); |
26 | html_txt(info->subject); | 26 | html_ntxt(80, info->subject); |
27 | html_link_close(); | 27 | html_link_close(); |
28 | html("</td><td>"); | 28 | html("</td><td>"); |
29 | html_txt(info->author); | 29 | html_txt(info->author); |
30 | html("</td></tr>\n"); | 30 | html("</td></tr>\n"); |
31 | cgit_free_commitinfo(info); | 31 | cgit_free_commitinfo(info); |
32 | } | 32 | } |
33 | 33 | ||
34 | 34 | ||
35 | void cgit_print_log(const char *tip, int ofs, int cnt) | 35 | void cgit_print_log(const char *tip, int ofs, int cnt) |
36 | { | 36 | { |
37 | struct rev_info rev; | 37 | struct rev_info rev; |
38 | struct commit *commit; | 38 | struct commit *commit; |
39 | const char *argv[2] = {NULL, tip}; | 39 | const char *argv[2] = {NULL, tip}; |
40 | int i; | 40 | int i; |
41 | 41 | ||
42 | init_revisions(&rev, NULL); | 42 | init_revisions(&rev, NULL); |
43 | rev.abbrev = DEFAULT_ABBREV; | 43 | rev.abbrev = DEFAULT_ABBREV; |
44 | rev.commit_format = CMIT_FMT_DEFAULT; | 44 | rev.commit_format = CMIT_FMT_DEFAULT; |
45 | rev.verbose_header = 1; | 45 | rev.verbose_header = 1; |
46 | rev.show_root_diff = 0; | 46 | rev.show_root_diff = 0; |
47 | setup_revisions(2, argv, &rev, NULL); | 47 | setup_revisions(2, argv, &rev, NULL); |
48 | prepare_revision_walk(&rev); | 48 | prepare_revision_walk(&rev); |
49 | 49 | ||
50 | html("<h2>Log</h2>"); | 50 | html("<h2>Log</h2>"); |
51 | html("<table class='list log'>"); | 51 | html("<table class='list nowrap'>"); |
52 | html("<tr><th class='left'>Date</th>" | 52 | html("<tr><th class='left'>Date</th>" |
53 | "<th class='left'>Message</th>" | 53 | "<th class='left'>Message</th>" |
54 | "<th class='left'>Author</th></tr>\n"); | 54 | "<th class='left'>Author</th></tr>\n"); |
55 | 55 | ||
56 | if (ofs<0) | 56 | if (ofs<0) |
57 | ofs = 0; | 57 | ofs = 0; |
58 | 58 | ||
59 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { | 59 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { |
60 | free(commit->buffer); | 60 | free(commit->buffer); |
61 | commit->buffer = NULL; | 61 | commit->buffer = NULL; |
62 | free_commit_list(commit->parents); | 62 | free_commit_list(commit->parents); |
63 | commit->parents = NULL; | 63 | commit->parents = NULL; |
64 | } | 64 | } |
65 | 65 | ||
66 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { | 66 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { |
67 | print_commit(commit); | 67 | print_commit(commit); |
68 | free(commit->buffer); | 68 | free(commit->buffer); |
69 | commit->buffer = NULL; | 69 | commit->buffer = NULL; |
70 | free_commit_list(commit->parents); | 70 | free_commit_list(commit->parents); |
71 | commit->parents = NULL; | 71 | commit->parents = NULL; |
72 | } | 72 | } |
73 | html("</table>\n"); | 73 | html("</table>\n"); |
74 | 74 | ||
75 | html("<div class='pager'>"); | 75 | html("<div class='pager'>"); |
76 | if (ofs > 0) { | 76 | if (ofs > 0) { |
77 | html(" <a href='"); | 77 | html(" <a href='"); |
78 | html(cgit_pageurl(cgit_query_repo, cgit_query_page, | 78 | html(cgit_pageurl(cgit_query_repo, cgit_query_page, |
79 | fmt("h=%s&ofs=%d", tip, ofs-cnt))); | 79 | fmt("h=%s&ofs=%d", tip, ofs-cnt))); |
80 | html("'>[prev]</a> "); | 80 | html("'>[prev]</a> "); |
81 | } | 81 | } |
82 | 82 | ||
83 | if ((commit = get_revision(&rev)) != NULL) { | 83 | if ((commit = get_revision(&rev)) != NULL) { |
84 | html(" <a href='"); | 84 | html(" <a href='"); |
85 | html(cgit_pageurl(cgit_query_repo, "log", | 85 | html(cgit_pageurl(cgit_query_repo, "log", |
86 | fmt("h=%s&ofs=%d", tip, ofs+cnt))); | 86 | fmt("h=%s&ofs=%d", tip, ofs+cnt))); |
87 | html("'>[next]</a> "); | 87 | html("'>[next]</a> "); |
88 | } | 88 | } |
89 | html("</div>"); | 89 | html("</div>"); |
90 | } | 90 | } |
91 | 91 | ||