summaryrefslogtreecommitdiffabout
path: root/ui-log.c
authorLars Hjemli <hjemli@gmail.com>2006-12-28 01:45:28 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2006-12-28 01:45:28 (UTC)
commit732d68d240b95dc428c92fc94bce9adb8912094e (patch) (unidiff)
tree24c6ab907c2a8574da12e426144706ad63780868 /ui-log.c
parente39d738c39d37cdef115c145027f3eec85a62272 (diff)
downloadcgit-732d68d240b95dc428c92fc94bce9adb8912094e.zip
cgit-732d68d240b95dc428c92fc94bce9adb8912094e.tar.gz
cgit-732d68d240b95dc428c92fc94bce9adb8912094e.tar.bz2
Add basic log filtering
This enables case-insensitive grep on logentris using the new search box Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ui-log.c b/ui-log.c
index f3b16e7..c353b2a 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -32,19 +32,26 @@ void print_commit(struct commit *commit)
32} 32}
33 33
34 34
35void cgit_print_log(const char *tip, int ofs, int cnt) 35void cgit_print_log(const char *tip, int ofs, int cnt, char *grep)
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[3] = {NULL, tip, NULL};
40 int argc = 2;
40 int i; 41 int i;
41 42
43 if (grep)
44 argv[argc++] = fmt("--grep=%s", grep);
42 init_revisions(&rev, NULL); 45 init_revisions(&rev, NULL);
43 rev.abbrev = DEFAULT_ABBREV; 46 rev.abbrev = DEFAULT_ABBREV;
44 rev.commit_format = CMIT_FMT_DEFAULT; 47 rev.commit_format = CMIT_FMT_DEFAULT;
45 rev.verbose_header = 1; 48 rev.verbose_header = 1;
46 rev.show_root_diff = 0; 49 rev.show_root_diff = 0;
47 setup_revisions(2, argv, &rev, NULL); 50 setup_revisions(argc, argv, &rev, NULL);
51 if (rev.grep_filter) {
52 rev.grep_filter->regflags |= REG_ICASE;
53 compile_grep_patterns(rev.grep_filter);
54 }
48 prepare_revision_walk(&rev); 55 prepare_revision_walk(&rev);
49 56
50 html("<h2>Log</h2>"); 57 html("<h2>Log</h2>");