aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 54dcdbe..ed9f05e 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -29,11 +29,16 @@ static int print_entry(const unsigned char *sha1, const char *base,
29 if (S_ISDIR(mode)) { 29 if (S_ISDIR(mode)) {
30 html("<div class='ls-dir'><a href='"); 30 html("<div class='ls-dir'><a href='");
31 html_attr(cgit_pageurl(cgit_query_repo, "tree", 31 html_attr(cgit_pageurl(cgit_query_repo, "tree",
32 fmt("id=%s", sha1_to_hex(sha1)))); 32 fmt("id=%s&path=%s%s/",
33 sha1_to_hex(sha1),
34 cgit_query_path ? cgit_query_path : "",
35 pathname)));
33 } else { 36 } else {
34 html("<div class='ls-blob'><a href='"); 37 html("<div class='ls-blob'><a href='");
35 html_attr(cgit_pageurl(cgit_query_repo, "view", 38 html_attr(cgit_pageurl(cgit_query_repo, "view",
36 fmt("id=%s", sha1_to_hex(sha1)))); 39 fmt("id=%s&path=%s%s", sha1_to_hex(sha1),
40 cgit_query_path ? cgit_query_path : "",
41 pathname)));
37 } 42 }
38 html("'>"); 43 html("'>");
39 html_txt(name); 44 html_txt(name);
@@ -46,7 +51,7 @@ static int print_entry(const unsigned char *sha1, const char *base,
46 return 0; 51 return 0;
47} 52}
48 53
49void cgit_print_tree(const char *hex) 54void cgit_print_tree(const char *hex, char *path)
50{ 55{
51 struct tree *tree; 56 struct tree *tree;
52 unsigned char sha1[20]; 57 unsigned char sha1[20];
@@ -62,6 +67,7 @@ void cgit_print_tree(const char *hex)
62 } 67 }
63 68
64 html("<h2>Tree content</h2>\n"); 69 html("<h2>Tree content</h2>\n");
70 html_txt(path);
65 html("<table class='list'>\n"); 71 html("<table class='list'>\n");
66 html("<tr>"); 72 html("<tr>");
67 html("<th class='left'>Mode</th>"); 73 html("<th class='left'>Mode</th>");