summaryrefslogtreecommitdiffabout
path: root/ui-tree.c
authorLars Hjemli <hjemli@gmail.com>2007-01-11 23:46:17 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-01-11 23:46:17 (UTC)
commit5cd2bf7e7f3f3daf6107cd3a269bad78e342de70 (patch) (side-by-side diff)
tree7ce9368e94b39114e772c279f741bd8106f611d2 /ui-tree.c
parent2c2047ff67a1e0053f95776e5079e432f69cea54 (diff)
downloadcgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.zip
cgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.tar.gz
cgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.tar.bz2
WIP: add paths/backlinks to tree/blobview
Diffstat (limited to 'ui-tree.c') (more/less context) (ignore whitespace changes)
-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
@@ -26,30 +26,35 @@ static int print_entry(const unsigned char *sha1, const char *base,
html("<tr><td class='filemode'>");
html_filemode(mode);
html("</td><td>");
if (S_ISDIR(mode)) {
html("<div class='ls-dir'><a href='");
html_attr(cgit_pageurl(cgit_query_repo, "tree",
- fmt("id=%s", sha1_to_hex(sha1))));
+ fmt("id=%s&path=%s%s/",
+ sha1_to_hex(sha1),
+ cgit_query_path ? cgit_query_path : "",
+ pathname)));
} else {
html("<div class='ls-blob'><a href='");
html_attr(cgit_pageurl(cgit_query_repo, "view",
- fmt("id=%s", sha1_to_hex(sha1))));
+ fmt("id=%s&path=%s%s", sha1_to_hex(sha1),
+ cgit_query_path ? cgit_query_path : "",
+ pathname)));
}
html("'>");
html_txt(name);
if (S_ISDIR(mode))
html("/");
html("</a></div></td>");
htmlf("<td class='filesize'>%li</td>", size);
html("</tr>\n");
free(name);
return 0;
}
-void cgit_print_tree(const char *hex)
+void cgit_print_tree(const char *hex, char *path)
{
struct tree *tree;
unsigned char sha1[20];
if (get_sha1_hex(hex, sha1)) {
cgit_print_error(fmt("Invalid object id: %s", hex));
@@ -59,12 +64,13 @@ void cgit_print_tree(const char *hex)
if (!tree) {
cgit_print_error(fmt("Not a tree object: %s", hex));
return;
}
html("<h2>Tree content</h2>\n");
+ html_txt(path);
html("<table class='list'>\n");
html("<tr>");
html("<th class='left'>Mode</th>");
html("<th class='left'>Name</th>");
html("<th class='right'>Size</th>");
html("</tr>\n");