abouttreesummaryrefslogcommitdiff
path: root/ui-blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-blob.c')
-rw-r--r--ui-blob.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui-blob.c b/ui-blob.c
index f76c641..3267ed1 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -65,6 +65,24 @@ done:
return walk_tree_ctx.found_path;
}
+int cgit_print_oid(const struct object_id *oid)
+{
+ enum object_type type;
+ char *buf;
+ unsigned long size;
+
+ type = oid_object_info(the_repository, oid, &size);
+ if (type == OBJ_BAD)
+ return -1;
+ buf = read_object_file(oid, &type, &size);
+ if (!buf)
+ return -1;
+ buf[size] = '\0';
+ html_raw(buf, size);
+ free(buf);
+ return 0;
+}
+
int cgit_print_file(char *path, const char *head, int file_only)
{
struct object_id oid;