From a737bc4695f99b05a3c4807c88fc30b1a1eb89b5 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 26 Jul 2021 17:33:54 +0200 Subject: Refactored the git tree, tree entry & blob classes --- packages/server/src/routes/api/v1/repo/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/server/src/routes/api/v1/repo') diff --git a/packages/server/src/routes/api/v1/repo/index.ts b/packages/server/src/routes/api/v1/repo/index.ts index 0042b60..395c108 100644 --- a/packages/server/src/routes/api/v1/repo/index.ts +++ b/packages/server/src/routes/api/v1/repo/index.ts @@ -3,7 +3,7 @@ import { FastifyInstance, FastifyPluginOptions } from "fastify"; import { Blob } from "../../../../git/blob"; import { Repository } from "../../../../git/repository"; import { Tag } from "../../../../git/tag"; -import { TreeEntry } from "../../../../git/tree_entry"; +import { BaseTreeEntry, TreeEntry } from "../../../../git/tree_entry"; import { basename } from "path"; import branches from "./branches"; import log from "./log"; @@ -36,11 +36,11 @@ function addHooks(fastify: FastifyInstance, opts: FastifyPluginOptions): void { } }); } -async function treeEntryMap(entry: TreeEntry) { +async function treeEntryMap(entry: BaseTreeEntry) { const latest_commit = await entry.latestCommit(); return { name: basename(entry.path), - type: entry.type, + type: entry instanceof TreeEntry ? "tree" : "blob", latest_commit: { id: latest_commit.id, message: latest_commit.message, -- cgit v1.2.3-18-g5258