]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-log.c
Add support for downloading single blobs
[cgit.git] / ui-log.c
index def96f6d44f49b0806eaee2f86dd9a47d24bdbf8..159393abf855ed9aff82d09149da1dd276a962af 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -23,7 +23,7 @@ void print_commit(struct commit *commit)
        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_txt(info->subject);
+       html_ntxt(cgit_max_msg_len, info->subject);
        html_link_close();
        html("</td><td>");
        html_txt(info->author);
@@ -32,24 +32,30 @@ void print_commit(struct commit *commit)
 }
 
 
-void cgit_print_log(const char *tip, int ofs, int cnt)
+void cgit_print_log(const char *tip, int ofs, int cnt, char *grep)
 {
        struct rev_info rev;
        struct commit *commit;
-       const char *argv[2] = {NULL, tip};
+       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(2, argv, &rev, NULL);
+       setup_revisions(argc, argv, &rev, NULL);
+       if (rev.grep_filter) {
+               rev.grep_filter->regflags |= REG_ICASE;
+               compile_grep_patterns(rev.grep_filter);
+       }
        prepare_revision_walk(&rev);
 
-       html("<h2>Log</h2>");
-       html("<table class='list log'>");
-       html("<tr><th class='left'>Date</th>"
+       html("<table class='list nowrap'>");
+       html("<tr class='nohover'><th class='left'>Date</th>"
             "<th class='left'>Message</th>"
             "<th class='left'>Author</th></tr>\n");