From f6a5fe05c887a658c20257d2ef6bf2780f792873 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 27 Jul 2021 13:18:42 +0200 Subject: Refactored the backend a bit & added TSDoc/JSDoc comments to the diff class --- packages/server/src/git/tree_entry.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'packages/server/src/git/tree_entry.ts') diff --git a/packages/server/src/git/tree_entry.ts b/packages/server/src/git/tree_entry.ts index 52f9988..99941cb 100644 --- a/packages/server/src/git/tree_entry.ts +++ b/packages/server/src/git/tree_entry.ts @@ -4,14 +4,15 @@ import { Repository } from "./repository"; import { dirname } from "path"; import { findAsync } from "./misc"; import { Tree } from "./tree"; +import { Blob } from "./blob"; /** * The core structure of a tree entry */ export abstract class BaseTreeEntry { - protected _ng_tree_entry: NodeGitTreeEntry; protected _owner: Repository; + public ng_tree_entry: NodeGitTreeEntry; public path: string; /** @@ -19,7 +20,7 @@ export abstract class BaseTreeEntry { * @param entry - An instance of a Nodegit tree entry */ constructor(owner: Repository, entry: NodeGitTreeEntry) { - this._ng_tree_entry = entry; + this.ng_tree_entry = entry; this._owner = owner; this.path = entry.path(); @@ -54,7 +55,7 @@ export class TreeEntry extends BaseTreeEntry { * @returns An instance of a tree */ public async tree(): Promise { - return new Tree(this._owner, await this._ng_tree_entry.getTree()); + return new Tree(this._owner, await this.ng_tree_entry.getTree()); } } @@ -63,10 +64,12 @@ export class TreeEntry extends BaseTreeEntry { */ export class BlobTreeEntry extends BaseTreeEntry { /** - * Returns the blob's content + * Returns the blob of the blob tree entry + * + * @returns An instance of a blob */ - public async content(): Promise { - return (await this._ng_tree_entry.getBlob()).toString(); + public async blob(): Promise { + return new Blob(this); } } -- cgit v1.2.3-18-g5258