diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-26 17:33:54 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-26 17:33:54 +0200 |
commit | a737bc4695f99b05a3c4807c88fc30b1a1eb89b5 (patch) | |
tree | 4ca8f9955a80a09a508c55f86daeb2aba2ae64ac /packages/server/src/routes/api | |
parent | 35151a0283141ddac96f8cc71b59cd1030e31f3d (diff) |
Refactored the git tree, tree entry & blob classes
Diffstat (limited to 'packages/server/src/routes/api')
-rw-r--r-- | packages/server/src/routes/api/v1/repo/index.ts | 6 |
1 files changed, 3 insertions, 3 deletions
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 <APITreeEntry>{ name: basename(entry.path), - type: entry.type, + type: entry instanceof TreeEntry ? "tree" : "blob", latest_commit: { id: latest_commit.id, message: latest_commit.message, |