Skip to content

Commit

Permalink
Cannot leave comments on hunks in large diffs
Browse files Browse the repository at this point in the history
Fixes #6524
  • Loading branch information
alexr00 committed Dec 20, 2024
1 parent 03410cb commit facaf96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/common/diffHunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export async function parseDiff(
continue;
}

const diffHunks = review.patch ? parsePatch(review.patch) : [];
const diffHunks = review.patch ? parsePatch(review.patch) : undefined;
fileChanges.push(
new InMemFileChange(
parentCommit,
Expand All @@ -364,7 +364,7 @@ export async function parseDiff(
review.previous_filename,
review.patch ?? '',
diffHunks,
review.blob_url,
review.blob_url
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class InMemFileChange implements SimpleFileChange {
public readonly fileName: string,
public readonly previousFileName: string | undefined,
public readonly patch: string,
public readonly diffHunks: DiffHunk[],
public readonly diffHunks: DiffHunk[] | undefined,
public readonly blobUrl: string,
) {}
) { }
}

export class SlimFileChange implements SimpleFileChange {
Expand All @@ -42,5 +42,5 @@ export class SlimFileChange implements SimpleFileChange {
public readonly status: GitChangeType,
public readonly fileName: string,
public readonly previousFileName: string | undefined,
) {}
) { }
}
2 changes: 1 addition & 1 deletion src/view/fileChangeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export abstract class FileChangeModel {
async diffHunks(): Promise<DiffHunk[]> {
let diffHunks: DiffHunk[] = [];

if (this.change instanceof InMemFileChange) {
if (this.change instanceof InMemFileChange && this.change.diffHunks) {
return this.change.diffHunks;
} else if (this.status !== GitChangeType.RENAME) {
try {
Expand Down

0 comments on commit facaf96

Please sign in to comment.