diff options
author | Lars Hjemli | 2007-05-08 22:40:59 +0200 |
---|---|---|
committer | Lars Hjemli | 2007-05-08 23:38:49 +0200 |
commit | 61c3ca978c586c673aec618cb94210657278dda8 (patch) | |
tree | 7011987769e65ad0e7aa8b79f648357e9cd88c30 /ui-tree.c | |
parent | 66cacd053ba900c8eb3b7962027370c84a97f990 (diff) | |
download | cgit-61c3ca978c586c673aec618cb94210657278dda8.tar.gz cgit-61c3ca978c586c673aec618cb94210657278dda8.tar.bz2 cgit-61c3ca978c586c673aec618cb94210657278dda8.zip |
Update to libgit 1.5.2-rc2
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r-- | ui-tree.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -14,37 +14,39 @@ static int print_entry(const unsigned char *sha1, const char *base, | |||
14 | int stage) | 14 | int stage) |
15 | { | 15 | { |
16 | char *name; | 16 | char *name; |
17 | char type[20]; | 17 | enum object_type type; |
18 | unsigned long size; | 18 | unsigned long size; |
19 | 19 | ||
20 | if (sha1_object_info(sha1, type, &size)) { | 20 | name = xstrdup(pathname); |
21 | cgit_print_error(fmt("Bad object name: %s", | 21 | type = sha1_object_info(sha1, &size); |
22 | sha1_to_hex(sha1))); | 22 | if (type == OBJ_BAD) { |
23 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", | ||
24 | name, | ||
25 | sha1_to_hex(sha1)); | ||
23 | return 0; | 26 | return 0; |
24 | } | 27 | } |
25 | name = xstrdup(pathname); | ||
26 | html("<tr><td class='filemode'>"); | 28 | html("<tr><td class='filemode'>"); |
27 | html_filemode(mode); | 29 | html_filemode(mode); |
28 | html("</td><td>"); | 30 | html("</td><td>"); |
29 | if (S_ISDIR(mode)) { | 31 | if (S_ISDIRLNK(mode)) { |
32 | htmlf("<div class='ls-dirlnk'>%s => submodule</div>", name); | ||
33 | } else if (S_ISDIR(mode)) { | ||
30 | html("<div class='ls-dir'><a href='"); | 34 | html("<div class='ls-dir'><a href='"); |
31 | html_attr(cgit_pageurl(cgit_query_repo, "tree", | 35 | html_attr(cgit_pageurl(cgit_query_repo, "tree", |
32 | fmt("id=%s&path=%s%s/", | 36 | fmt("id=%s&path=%s%s/", |
33 | sha1_to_hex(sha1), | 37 | sha1_to_hex(sha1), |
34 | cgit_query_path ? cgit_query_path : "", | 38 | cgit_query_path ? cgit_query_path : "", |
35 | pathname))); | 39 | pathname))); |
40 | htmlf("'>%s</a></div>", name); | ||
36 | } else { | 41 | } else { |
37 | html("<div class='ls-blob'><a href='"); | 42 | html("<div class='ls-blob'><a href='"); |
38 | html_attr(cgit_pageurl(cgit_query_repo, "view", | 43 | html_attr(cgit_pageurl(cgit_query_repo, "view", |
39 | fmt("id=%s&path=%s%s", sha1_to_hex(sha1), | 44 | fmt("id=%s&path=%s%s", sha1_to_hex(sha1), |
40 | cgit_query_path ? cgit_query_path : "", | 45 | cgit_query_path ? cgit_query_path : "", |
41 | pathname))); | 46 | pathname))); |
47 | htmlf("'>%s</a></div>", name); | ||
42 | } | 48 | } |
43 | html("'>"); | 49 | html("</div></td>"); |
44 | html_txt(name); | ||
45 | if (S_ISDIR(mode)) | ||
46 | html("/"); | ||
47 | html("</a></div></td>"); | ||
48 | htmlf("<td class='filesize'>%li</td>", size); | 50 | htmlf("<td class='filesize'>%li</td>", size); |
49 | html("</tr>\n"); | 51 | html("</tr>\n"); |
50 | free(name); | 52 | free(name); |