Skip to content

Commit 17174bd

Browse files
authored
Cannot leave comments on hunks in large diffs (#6574)
Fixes #6524
1 parent 96ec9a1 commit 17174bd

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/common/diffHunk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export async function parseDiff(
355355
continue;
356356
}
357357

358-
const diffHunks = review.patch ? parsePatch(review.patch) : [];
358+
const diffHunks = review.patch ? parsePatch(review.patch) : undefined;
359359
fileChanges.push(
360360
new InMemFileChange(
361361
parentCommit,
@@ -364,7 +364,7 @@ export async function parseDiff(
364364
review.previous_filename,
365365
review.patch ?? '',
366366
diffHunks,
367-
review.blob_url,
367+
review.blob_url
368368
),
369369
);
370370
}

src/common/file.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export class InMemFileChange implements SimpleFileChange {
3030
public readonly fileName: string,
3131
public readonly previousFileName: string | undefined,
3232
public readonly patch: string,
33-
public readonly diffHunks: DiffHunk[],
33+
public readonly diffHunks: DiffHunk[] | undefined,
3434
public readonly blobUrl: string,
35-
) {}
35+
) { }
3636
}
3737

3838
export class SlimFileChange implements SimpleFileChange {
@@ -42,5 +42,5 @@ export class SlimFileChange implements SimpleFileChange {
4242
public readonly status: GitChangeType,
4343
public readonly fileName: string,
4444
public readonly previousFileName: string | undefined,
45-
) {}
45+
) { }
4646
}

src/view/fileChangeModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export abstract class FileChangeModel {
5151
async diffHunks(): Promise<DiffHunk[]> {
5252
let diffHunks: DiffHunk[] = [];
5353

54-
if (this.change instanceof InMemFileChange) {
54+
if (this.change instanceof InMemFileChange && this.change.diffHunks) {
5555
return this.change.diffHunks;
5656
} else if (this.status !== GitChangeType.RENAME) {
5757
try {

0 commit comments

Comments
 (0)