summaryrefslogtreecommitdiffabout
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
parent2c2047ff67a1e0053f95776e5079e432f69cea54 (diff)
downloadcgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.zip
cgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.tar.gz
cgit-5cd2bf7e7f3f3daf6107cd3a269bad78e342de70.tar.bz2
WIP: add paths/backlinks to tree/blobview
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h3
-rw-r--r--shared.c3
-rw-r--r--ui-tree.c12
4 files changed, 15 insertions, 5 deletions
diff --git a/cgit.c b/cgit.c
index a3a04d9..9535abc 100644
--- a/cgit.c
+++ b/cgit.c
@@ -58,3 +58,3 @@ static void cgit_print_repo_page(struct cacheitem *item)
} else if (!strcmp(cgit_query_page, "tree")) {
- cgit_print_tree(cgit_query_sha1);
+ cgit_print_tree(cgit_query_sha1, cgit_query_path);
} else if (!strcmp(cgit_query_page, "commit")) {
diff --git a/cgit.h b/cgit.h
index 3601e49..5e19b11 100644
--- a/cgit.h
+++ b/cgit.h
@@ -61,2 +61,3 @@ extern char *cgit_query_sha1;
extern char *cgit_query_sha2;
+extern char *cgit_query_path;
extern int cgit_query_ofs;
@@ -110,3 +111,3 @@ extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep);
extern void cgit_print_view(const char *hex);
-extern void cgit_print_tree(const char *hex);
+extern void cgit_print_tree(const char *hex, char *path);
extern void cgit_print_commit(const char *hex);
diff --git a/shared.c b/shared.c
index e4595fa..dd711a8 100644
--- a/shared.c
+++ b/shared.c
@@ -41,2 +41,3 @@ char *cgit_query_sha1 = NULL;
char *cgit_query_sha2 = NULL;
+char *cgit_query_path = NULL;
int cgit_query_ofs = 0;
@@ -102,2 +103,4 @@ void cgit_querystring_cb(const char *name, const char *value)
cgit_query_ofs = atoi(value);
+ } else if (!strcmp(name, "path")) {
+ cgit_query_path = xstrdup(value);
}
diff --git a/ui-tree.c b/ui-tree.c
index 54dcdbe..ed9f05e 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -31,3 +31,6 @@ static int print_entry(const unsigned char *sha1, const char *base,
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 {
@@ -35,3 +38,5 @@ static int print_entry(const unsigned char *sha1, const char *base,
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)));
}
@@ -48,3 +53,3 @@ static int print_entry(const unsigned char *sha1, const char *base,
-void cgit_print_tree(const char *hex)
+void cgit_print_tree(const char *hex, char *path)
{
@@ -64,2 +69,3 @@ void cgit_print_tree(const char *hex)
html("<h2>Tree content</h2>\n");
+ html_txt(path);
html("<table class='list'>\n");