]> gitweb.ps.run Git - ps-cgit/commitdiff
ui-tree.c: avoid peeking at GITLINK objects
authorLars Hjemli <hjemli@gmail.com>
Tue, 20 May 2008 20:32:22 +0000 (22:32 +0200)
committerLars Hjemli <hjemli@gmail.com>
Tue, 20 May 2008 20:32:22 +0000 (22:32 +0200)
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>
ui-tree.c

index 2f052c71e13077ca2caed29a419401b39062ed6b..5a2dd3f2946e3b5a2783744be144eb4628da8131 100644 (file)
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -73,12 +73,14 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
        fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
                       ctx.qry.path ? "/" : "", name);
 
-       type = sha1_object_info(sha1, &size);
-       if (type == OBJ_BAD && !S_ISGITLINK(mode)) {
-               htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
-                     name,
-                     sha1_to_hex(sha1));
-               return 0;
+       if (!S_ISGITLINK(mode)) {
+               type = sha1_object_info(sha1, &size);
+               if (type == OBJ_BAD) {
+                       htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
+                             name,
+                             sha1_to_hex(sha1));
+                       return 0;
+               }
        }
 
        html("<tr><td class='ls-mode'>");