|
diff --git a/ui-tree.c b/ui-tree.c index df05ad3..7912784 100644 --- a/ ui-tree.c+++ b/ ui-tree.c |
|
@@ -1,21 +1,22 @@ |
1 | /* ui-tree.c: functions for tree output |
1 | /* ui-tree.c: functions for tree output |
2 | * |
2 | * |
3 | * Copyright (C) 2006 Lars Hjemli |
3 | * Copyright (C) 2006 Lars Hjemli |
4 | * |
4 | * |
5 | * Licensed under GNU General Public License v2 |
5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) |
6 | * (see COPYING for full license text) |
7 | */ |
7 | */ |
8 | |
8 | |
9 | #include "cgit.h" |
9 | #include "cgit.h" |
| |
10 | #include "html.h" |
10 | |
11 | |
11 | char *curr_rev; |
12 | char *curr_rev; |
12 | char *match_path; |
13 | char *match_path; |
13 | int header = 0; |
14 | int header = 0; |
14 | |
15 | |
15 | static void print_object(const unsigned char *sha1, char *path) |
16 | static void print_object(const unsigned char *sha1, char *path) |
16 | { |
17 | { |
17 | enum object_type type; |
18 | enum object_type type; |
18 | char *buf; |
19 | char *buf; |
19 | unsigned long size, lineno, start, idx; |
20 | unsigned long size, lineno, start, idx; |
20 | const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>"; |
21 | const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>"; |
21 | |
22 | |
@@ -70,25 +71,25 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, |
70 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", |
71 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", |
71 | ctx.qry.path ? "/" : "", name); |
72 | ctx.qry.path ? "/" : "", name); |
72 | |
73 | |
73 | type = sha1_object_info(sha1, &size); |
74 | type = sha1_object_info(sha1, &size); |
74 | if (type == OBJ_BAD && !S_ISGITLINK(mode)) { |
75 | if (type == OBJ_BAD && !S_ISGITLINK(mode)) { |
75 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
76 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
76 | name, |
77 | name, |
77 | sha1_to_hex(sha1)); |
78 | sha1_to_hex(sha1)); |
78 | return 0; |
79 | return 0; |
79 | } |
80 | } |
80 | |
81 | |
81 | html("<tr><td class='ls-mode'>"); |
82 | html("<tr><td class='ls-mode'>"); |
82 | html_filemode(mode); |
83 | cgit_print_filemode(mode); |
83 | html("</td><td>"); |
84 | html("</td><td>"); |
84 | if (S_ISGITLINK(mode)) { |
85 | if (S_ISGITLINK(mode)) { |
85 | htmlf("<a class='ls-mod' href='"); |
86 | htmlf("<a class='ls-mod' href='"); |
86 | html_attr(fmt(ctx.repo->module_link, |
87 | html_attr(fmt(ctx.repo->module_link, |
87 | name, |
88 | name, |
88 | sha1_to_hex(sha1))); |
89 | sha1_to_hex(sha1))); |
89 | html("'>"); |
90 | html("'>"); |
90 | html_txt(name); |
91 | html_txt(name); |
91 | html("</a>"); |
92 | html("</a>"); |
92 | } else if (S_ISDIR(mode)) { |
93 | } else if (S_ISDIR(mode)) { |
93 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, |
94 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, |
94 | curr_rev, fullpath); |
95 | curr_rev, fullpath); |
|