From 9fb53af215639fcd3bfb876fa9c8bac221244bdf Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 14 May 2007 11:10:59 +0200 Subject: Add log filtering by path and link to it from tree view This enables path-filtering in log-view, and adds a link per entry in tree-view to show the log for each file/directory. Signed-off-by: Lars Hjemli --- ui-tree.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'ui-tree.c') diff --git a/ui-tree.c b/ui-tree.c index dee8309..db63e13 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -8,9 +8,10 @@ #include "cgit.h" +char *curr_rev; -static int print_entry(const unsigned char *sha1, const char *base, - int baselen, const char *pathname, unsigned int mode, +static int print_entry(const unsigned char *sha1, const char *base, + int baselen, const char *pathname, unsigned int mode, int stage) { char *name; @@ -35,30 +36,41 @@ static int print_entry(const unsigned char *sha1, const char *base, sha1_to_hex(sha1))); } else if (S_ISDIR(mode)) { html("class='ls-dir'>%s", name); htmlf("%li", size); + + html("history"); html("\n"); free(name); return 0; } -void cgit_print_tree(const char *hex, char *path) +void cgit_print_tree(const char *rev, const char *hex, char *path) { struct tree *tree; unsigned char sha1[20]; + curr_rev = xstrdup(rev); if (get_sha1_hex(hex, sha1)) { cgit_print_error(fmt("Invalid object id: %s", hex)); return; @@ -75,6 +87,7 @@ void cgit_print_tree(const char *hex, char *path) html("Mode"); html("Name"); html("Size"); + html(""); html("\n"); read_tree_recursive(tree, "", 0, 1, NULL, print_entry); html("\n"); -- cgit v1.2.3-59-g8ed1b