author | Lars Hjemli <hjemli@gmail.com> | 2008-10-05 17:19:59 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-10-05 17:19:59 (UTC) |
commit | b7f33786ef4b155a11b0324f84bbde5d7fc9c998 (patch) (unidiff) | |
tree | 3ccdd8ca2e02cb80814727bddd5083a8ea046843 /ui-log.c | |
parent | b9aabf0b8fbf3a3ab69010ee2c9ed5426c751912 (diff) | |
download | cgit-b7f33786ef4b155a11b0324f84bbde5d7fc9c998.zip cgit-b7f33786ef4b155a11b0324f84bbde5d7fc9c998.tar.gz cgit-b7f33786ef4b155a11b0324f84bbde5d7fc9c998.tar.bz2 |
Use GIT-1.6.0.2
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-log.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -47,100 +47,98 @@ void print_commit(struct commit *commit) | |||
47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
48 | sha1_to_hex(commit->object.sha1)); | 48 | sha1_to_hex(commit->object.sha1)); |
49 | html("</td><td>"); | 49 | html("</td><td>"); |
50 | html_txt(info->author); | 50 | html_txt(info->author); |
51 | if (ctx.repo->enable_log_filecount) { | 51 | if (ctx.repo->enable_log_filecount) { |
52 | files = 0; | 52 | files = 0; |
53 | add_lines = 0; | 53 | add_lines = 0; |
54 | rem_lines = 0; | 54 | rem_lines = 0; |
55 | cgit_diff_commit(commit, inspect_files); | 55 | cgit_diff_commit(commit, inspect_files); |
56 | html("</td><td>"); | 56 | html("</td><td>"); |
57 | htmlf("%d", files); | 57 | htmlf("%d", files); |
58 | if (ctx.repo->enable_log_linecount) { | 58 | if (ctx.repo->enable_log_linecount) { |
59 | html("</td><td>"); | 59 | html("</td><td>"); |
60 | htmlf("-%d/+%d", rem_lines, add_lines); | 60 | htmlf("-%d/+%d", rem_lines, add_lines); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | html("</td></tr>\n"); | 63 | html("</td></tr>\n"); |
64 | cgit_free_commitinfo(info); | 64 | cgit_free_commitinfo(info); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, | 68 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
69 | char *path, int pager) | 69 | char *path, int pager) |
70 | { | 70 | { |
71 | struct rev_info rev; | 71 | struct rev_info rev; |
72 | struct commit *commit; | 72 | struct commit *commit; |
73 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; | 73 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; |
74 | int argc = 2; | 74 | int argc = 2; |
75 | int i, columns = 3; | 75 | int i, columns = 3; |
76 | 76 | ||
77 | if (!tip) | 77 | if (!tip) |
78 | argv[1] = ctx.qry.head; | 78 | argv[1] = ctx.qry.head; |
79 | 79 | ||
80 | if (grep && pattern && (!strcmp(grep, "grep") || | 80 | if (grep && pattern && (!strcmp(grep, "grep") || |
81 | !strcmp(grep, "author") || | 81 | !strcmp(grep, "author") || |
82 | !strcmp(grep, "committer"))) | 82 | !strcmp(grep, "committer"))) |
83 | argv[argc++] = fmt("--%s=%s", grep, pattern); | 83 | argv[argc++] = fmt("--%s=%s", grep, pattern); |
84 | 84 | ||
85 | if (path) { | 85 | if (path) { |
86 | argv[argc++] = "--"; | 86 | argv[argc++] = "--"; |
87 | argv[argc++] = path; | 87 | argv[argc++] = path; |
88 | } | 88 | } |
89 | init_revisions(&rev, NULL); | 89 | init_revisions(&rev, NULL); |
90 | rev.abbrev = DEFAULT_ABBREV; | 90 | rev.abbrev = DEFAULT_ABBREV; |
91 | rev.commit_format = CMIT_FMT_DEFAULT; | 91 | rev.commit_format = CMIT_FMT_DEFAULT; |
92 | rev.verbose_header = 1; | 92 | rev.verbose_header = 1; |
93 | rev.show_root_diff = 0; | 93 | rev.show_root_diff = 0; |
94 | setup_revisions(argc, argv, &rev, NULL); | 94 | setup_revisions(argc, argv, &rev, NULL); |
95 | if (rev.grep_filter) { | 95 | rev.grep_filter.regflags |= REG_ICASE; |
96 | rev.grep_filter->regflags |= REG_ICASE; | 96 | compile_grep_patterns(&rev.grep_filter); |
97 | compile_grep_patterns(rev.grep_filter); | ||
98 | } | ||
99 | prepare_revision_walk(&rev); | 97 | prepare_revision_walk(&rev); |
100 | 98 | ||
101 | if (pager) | 99 | if (pager) |
102 | html("<table class='list nowrap'>"); | 100 | html("<table class='list nowrap'>"); |
103 | 101 | ||
104 | html("<tr class='nohover'><th class='left'>Age</th>" | 102 | html("<tr class='nohover'><th class='left'>Age</th>" |
105 | "<th class='left'>Commit message</th>" | 103 | "<th class='left'>Commit message</th>" |
106 | "<th class='left'>Author</th>"); | 104 | "<th class='left'>Author</th>"); |
107 | if (ctx.repo->enable_log_filecount) { | 105 | if (ctx.repo->enable_log_filecount) { |
108 | html("<th class='left'>Files</th>"); | 106 | html("<th class='left'>Files</th>"); |
109 | columns++; | 107 | columns++; |
110 | if (ctx.repo->enable_log_linecount) { | 108 | if (ctx.repo->enable_log_linecount) { |
111 | html("<th class='left'>Lines</th>"); | 109 | html("<th class='left'>Lines</th>"); |
112 | columns++; | 110 | columns++; |
113 | } | 111 | } |
114 | } | 112 | } |
115 | html("</tr>\n"); | 113 | html("</tr>\n"); |
116 | 114 | ||
117 | if (ofs<0) | 115 | if (ofs<0) |
118 | ofs = 0; | 116 | ofs = 0; |
119 | 117 | ||
120 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { | 118 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { |
121 | free(commit->buffer); | 119 | free(commit->buffer); |
122 | commit->buffer = NULL; | 120 | commit->buffer = NULL; |
123 | free_commit_list(commit->parents); | 121 | free_commit_list(commit->parents); |
124 | commit->parents = NULL; | 122 | commit->parents = NULL; |
125 | } | 123 | } |
126 | 124 | ||
127 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { | 125 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { |
128 | print_commit(commit); | 126 | print_commit(commit); |
129 | free(commit->buffer); | 127 | free(commit->buffer); |
130 | commit->buffer = NULL; | 128 | commit->buffer = NULL; |
131 | free_commit_list(commit->parents); | 129 | free_commit_list(commit->parents); |
132 | commit->parents = NULL; | 130 | commit->parents = NULL; |
133 | } | 131 | } |
134 | if (pager) { | 132 | if (pager) { |
135 | htmlf("</table><div class='pager'>", | 133 | htmlf("</table><div class='pager'>", |
136 | columns); | 134 | columns); |
137 | if (ofs > 0) { | 135 | if (ofs > 0) { |
138 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 136 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
139 | ctx.qry.sha1, ctx.qry.path, | 137 | ctx.qry.sha1, ctx.qry.path, |
140 | ofs - cnt, ctx.qry.grep, | 138 | ofs - cnt, ctx.qry.grep, |
141 | ctx.qry.search); | 139 | ctx.qry.search); |
142 | html(" "); | 140 | html(" "); |
143 | } | 141 | } |
144 | if ((commit = get_revision(&rev)) != NULL) { | 142 | if ((commit = get_revision(&rev)) != NULL) { |
145 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, | 143 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
146 | ctx.qry.sha1, ctx.qry.path, | 144 | ctx.qry.sha1, ctx.qry.path, |