diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-27 13:18:42 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-27 13:18:42 +0200 |
commit | f6a5fe05c887a658c20257d2ef6bf2780f792873 (patch) | |
tree | 9ee4b42ed04b3fe7decdac10b20ec96ca764d378 /packages/server/src/git/tree_entry.ts | |
parent | 69c58c94bd8cc0d469ae301931d4571aca84851a (diff) |
Refactored the backend a bit & added TSDoc/JSDoc comments to the diff class
Diffstat (limited to 'packages/server/src/git/tree_entry.ts')
-rw-r--r-- | packages/server/src/git/tree_entry.ts | 15 |
1 files changed, 9 insertions, 6 deletions
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<Tree> { - 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<string> { - return (await this._ng_tree_entry.getBlob()).toString(); + public async blob(): Promise<Blob> { + return new Blob(this); } } |