author | Lars Hjemli <hjemli@gmail.com> | 2008-05-20 20:32:22 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-05-20 20:32:22 (UTC) |
commit | 08a8757fa54ee70d31882344ca7f19de5cbe4690 (patch) (unidiff) | |
tree | 93cddfcbb81bbaf0fe8b3206d5f2f9c11dc6df9a /ui-tree.c | |
parent | dd7c172542440170b5b1aca8be43d2ad6dae7227 (diff) | |
download | cgit-08a8757fa54ee70d31882344ca7f19de5cbe4690.zip cgit-08a8757fa54ee70d31882344ca7f19de5cbe4690.tar.gz cgit-08a8757fa54ee70d31882344ca7f19de5cbe4690.tar.bz2 |
ui-tree.c: avoid peeking at GITLINK objects
When an object in the tree has GITLINK mode-bits we don't need to get any
more info about that particular object (and trying to get more info about
it will usually generate an annoying warning on stderr since the object
typically doesn't exist in the repo anyways).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tree.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -64,30 +64,32 @@ static void print_object(const unsigned char *sha1, char *path) | |||
64 | static int ls_item(const unsigned char *sha1, const char *base, int baselen, | 64 | static int ls_item(const unsigned char *sha1, const char *base, int baselen, |
65 | const char *pathname, unsigned int mode, int stage) | 65 | const char *pathname, unsigned int mode, int stage) |
66 | { | 66 | { |
67 | char *name; | 67 | char *name; |
68 | char *fullpath; | 68 | char *fullpath; |
69 | enum object_type type; | 69 | enum object_type type; |
70 | unsigned long size = 0; | 70 | unsigned long size = 0; |
71 | 71 | ||
72 | name = xstrdup(pathname); | 72 | name = xstrdup(pathname); |
73 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", | 73 | fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", |
74 | ctx.qry.path ? "/" : "", name); | 74 | ctx.qry.path ? "/" : "", name); |
75 | 75 | ||
76 | type = sha1_object_info(sha1, &size); | 76 | if (!S_ISGITLINK(mode)) { |
77 | if (type == OBJ_BAD && !S_ISGITLINK(mode)) { | 77 | type = sha1_object_info(sha1, &size); |
78 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", | 78 | if (type == OBJ_BAD) { |
79 | name, | 79 | htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", |
80 | sha1_to_hex(sha1)); | 80 | name, |
81 | return 0; | 81 | sha1_to_hex(sha1)); |
82 | return 0; | ||
83 | } | ||
82 | } | 84 | } |
83 | 85 | ||
84 | html("<tr><td class='ls-mode'>"); | 86 | html("<tr><td class='ls-mode'>"); |
85 | cgit_print_filemode(mode); | 87 | cgit_print_filemode(mode); |
86 | html("</td><td>"); | 88 | html("</td><td>"); |
87 | if (S_ISGITLINK(mode)) { | 89 | if (S_ISGITLINK(mode)) { |
88 | htmlf("<a class='ls-mod' href='"); | 90 | htmlf("<a class='ls-mod' href='"); |
89 | html_attr(fmt(ctx.repo->module_link, | 91 | html_attr(fmt(ctx.repo->module_link, |
90 | name, | 92 | name, |
91 | sha1_to_hex(sha1))); | 93 | sha1_to_hex(sha1))); |
92 | html("'>"); | 94 | html("'>"); |
93 | html_txt(name); | 95 | html_txt(name); |