author | Lars Hjemli <hjemli@gmail.com> | 2007-05-14 09:10:59 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-14 09:13:18 (UTC) |
commit | 9fb53af215639fcd3bfb876fa9c8bac221244bdf (patch) (unidiff) | |
tree | 3ebbebebed59b53066e16720a32e1b34c54dc609 | |
parent | 4fdf571c888fd38ae362684c429a3bdf24240ef7 (diff) | |
download | cgit-9fb53af215639fcd3bfb876fa9c8bac221244bdf.zip cgit-9fb53af215639fcd3bfb876fa9c8bac221244bdf.tar.gz cgit-9fb53af215639fcd3bfb876fa9c8bac221244bdf.tar.bz2 |
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 <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 5 | ||||
-rw-r--r-- | cgit.css | 5 | ||||
-rw-r--r-- | cgit.h | 4 | ||||
-rw-r--r-- | ui-commit.c | 3 | ||||
-rw-r--r-- | ui-log.c | 8 | ||||
-rw-r--r-- | ui-tree.c | 25 |
6 files changed, 37 insertions, 13 deletions
@@ -110,5 +110,6 @@ static void cgit_print_repo_page(struct cacheitem *item) | |||
110 | cgit_print_log(cgit_query_head, cgit_query_ofs, | 110 | cgit_print_log(cgit_query_head, cgit_query_ofs, |
111 | cgit_max_commit_count, cgit_query_search); | 111 | cgit_max_commit_count, cgit_query_search, |
112 | cgit_query_path); | ||
112 | } else if (!strcmp(cgit_query_page, "tree")) { | 113 | } else if (!strcmp(cgit_query_page, "tree")) { |
113 | cgit_print_tree(cgit_query_sha1, cgit_query_path); | 114 | cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path); |
114 | } else if (!strcmp(cgit_query_page, "commit")) { | 115 | } else if (!strcmp(cgit_query_page, "commit")) { |
@@ -191,2 +191,7 @@ td.filesize { | |||
191 | 191 | ||
192 | td.links { | ||
193 | font-size: 80%; | ||
194 | padding-left: 2em; | ||
195 | } | ||
196 | |||
192 | td.filemode { | 197 | td.filemode { |
@@ -171,6 +171,6 @@ extern void cgit_print_repolist(struct cacheitem *item); | |||
171 | extern void cgit_print_summary(); | 171 | extern void cgit_print_summary(); |
172 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep); | 172 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); |
173 | extern void cgit_print_view(const char *hex, char *path); | 173 | extern void cgit_print_view(const char *hex, char *path); |
174 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); | 174 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
175 | extern void cgit_print_tree(const char *hex, char *path); | 175 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); |
176 | extern void cgit_print_commit(const char *hex); | 176 | extern void cgit_print_commit(const char *hex); |
diff --git a/ui-commit.c b/ui-commit.c index b3d1c28..20a7cb2 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -188,3 +188,4 @@ void cgit_print_commit(const char *hex) | |||
188 | html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='"); | 188 | html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='"); |
189 | query = fmt("id=%s", sha1_to_hex(commit->tree->object.sha1)); | 189 | query = fmt("h=%s&id=%s", sha1_to_hex(commit->object.sha1), |
190 | sha1_to_hex(commit->tree->object.sha1)); | ||
190 | html_attr(cgit_pageurl(cgit_query_repo, "tree", query)); | 191 | html_attr(cgit_pageurl(cgit_query_repo, "tree", query)); |
@@ -55,3 +55,3 @@ void print_commit(struct commit *commit) | |||
55 | 55 | ||
56 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) | 56 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path) |
57 | { | 57 | { |
@@ -59,3 +59,3 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) | |||
59 | struct commit *commit; | 59 | struct commit *commit; |
60 | const char *argv[3] = {NULL, tip, NULL}; | 60 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; |
61 | int argc = 2; | 61 | int argc = 2; |
@@ -65,2 +65,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) | |||
65 | argv[argc++] = fmt("--grep=%s", grep); | 65 | argv[argc++] = fmt("--grep=%s", grep); |
66 | if (path) { | ||
67 | argv[argc++] = "--"; | ||
68 | argv[argc++] = path; | ||
69 | } | ||
66 | init_revisions(&rev, NULL); | 70 | init_revisions(&rev, NULL); |
@@ -10,5 +10,6 @@ | |||
10 | 10 | ||
11 | char *curr_rev; | ||
11 | 12 | ||
12 | static int print_entry(const unsigned char *sha1, const char *base, | 13 | static int print_entry(const unsigned char *sha1, const char *base, |
13 | int baselen, const char *pathname, unsigned int mode, | 14 | int baselen, const char *pathname, unsigned int mode, |
14 | int stage) | 15 | int stage) |
@@ -37,4 +38,5 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
37 | html("class='ls-dir'><a href='"); | 38 | html("class='ls-dir'><a href='"); |
38 | html_attr(cgit_pageurl(cgit_query_repo, "tree", | 39 | html_attr(cgit_pageurl(cgit_query_repo, "tree", |
39 | fmt("id=%s&path=%s%s/", | 40 | fmt("h=%s&id=%s&path=%s%s/", |
41 | curr_rev, | ||
40 | sha1_to_hex(sha1), | 42 | sha1_to_hex(sha1), |
@@ -45,3 +47,4 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
45 | html_attr(cgit_pageurl(cgit_query_repo, "view", | 47 | html_attr(cgit_pageurl(cgit_query_repo, "view", |
46 | fmt("id=%s&path=%s%s", sha1_to_hex(sha1), | 48 | fmt("h=%s&id=%s&path=%s%s", curr_rev, |
49 | sha1_to_hex(sha1), | ||
47 | cgit_query_path ? cgit_query_path : "", | 50 | cgit_query_path ? cgit_query_path : "", |
@@ -51,2 +54,10 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
51 | htmlf("<td class='filesize'>%li</td>", size); | 54 | htmlf("<td class='filesize'>%li</td>", size); |
55 | |||
56 | html("<td class='links'><a href='"); | ||
57 | html_attr(cgit_pageurl(cgit_query_repo, "log", | ||
58 | fmt("h=%s&path=%s%s", | ||
59 | curr_rev, | ||
60 | cgit_query_path ? cgit_query_path : "", | ||
61 | pathname))); | ||
62 | html("'>history</a></td>"); | ||
52 | html("</tr>\n"); | 63 | html("</tr>\n"); |
@@ -56,3 +67,3 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
56 | 67 | ||
57 | void cgit_print_tree(const char *hex, char *path) | 68 | void cgit_print_tree(const char *rev, const char *hex, char *path) |
58 | { | 69 | { |
@@ -61,2 +72,3 @@ void cgit_print_tree(const char *hex, char *path) | |||
61 | 72 | ||
73 | curr_rev = xstrdup(rev); | ||
62 | if (get_sha1_hex(hex, sha1)) { | 74 | if (get_sha1_hex(hex, sha1)) { |
@@ -77,2 +89,3 @@ void cgit_print_tree(const char *hex, char *path) | |||
77 | html("<th class='right'>Size</th>"); | 89 | html("<th class='right'>Size</th>"); |
90 | html("<th/>"); | ||
78 | html("</tr>\n"); | 91 | html("</tr>\n"); |