diff options
Diffstat (limited to 'packages/server')
-rw-r--r-- | packages/server/src/git/patch.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/server/src/git/patch.ts b/packages/server/src/git/patch.ts index 126b203..f7eb88e 100644 --- a/packages/server/src/git/patch.ts +++ b/packages/server/src/git/patch.ts @@ -89,10 +89,14 @@ export class Patch { return false; } - public async getHunks(index: number): Promise<Hunk[] | null> { - const content = (await this.content(index)).split("\n"); + public async getHunks(patch_index: number): Promise<Hunk[] | null> { + const content = (await this.content(patch_index)).split("\n"); const hunks = await this._ng_patch.hunks(); + if(hunks.length === 0) { + return null; + } + const hunks_data = hunks.reduce((result: Hunks, hunk, hunk_index) => { const hunk_header = hunk.header(); const hunk_header_index = content.indexOf(hunk_header.replace(/\n/gu, "")); |